Skip to content

Commit

Permalink
Merge branch 'master' into bump_min_python_version
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored Jan 2, 2025
2 parents 22e1f74 + 8932c1b commit cda55bc
Show file tree
Hide file tree
Showing 13,378 changed files with 1,672,144 additions and 702,290 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
221 changes: 0 additions & 221 deletions .ci/azure-pipelines/azure-pipelines.yml

This file was deleted.

100 changes: 55 additions & 45 deletions .ci/ctest2ci.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
***************************************************************************
Expand All @@ -18,51 +17,56 @@
***************************************************************************
"""

__author__ = 'Matthias Kuhn'
__date__ = 'March 2017'
__copyright__ = '(C) 2017, Matthias Kuhn'
__author__ = "Matthias Kuhn"
__date__ = "March 2017"
__copyright__ = "(C) 2017, Matthias Kuhn"

# This script parses output from ctest and injects
#
# - Colors for failing unit tests and test cases
# - Group control sequences to hide uninteresting output by default

import sys
import re
import string
import subprocess
import sys

from termcolor import colored
import string

fold_stack = list()
printable = set(string.printable)


def start_fold(tag):
sys.stdout.write('::group::{}\n'.format(tag))
sys.stdout.write(f"::group::{tag}\n")
fold_stack.append(tag)


def end_fold():
try:
tag = fold_stack.pop()
sys.stdout.write('::endgroup::\n')
sys.stdout.write("::endgroup::\n")
except IndexError:
updated_line = colored("======================", 'magenta')
updated_line += colored("ctest2ci error when processing the following line:", 'magenta')
updated_line += colored("----------------------", 'magenta')
updated_line += colored(updated_line, 'magenta')
updated_line += colored("----------------------", 'magenta')
updated_line += colored("Tried to end fold, but fold was never started.", 'magenta')
updated_line += colored("======================", 'magenta')
updated_line = colored("======================", "magenta")
updated_line += colored(
"ctest2ci error when processing the following line:", "magenta"
)
updated_line += colored("----------------------", "magenta")
updated_line += colored(updated_line, "magenta")
updated_line += colored("----------------------", "magenta")
updated_line += colored(
"Tried to end fold, but fold was never started.", "magenta"
)
updated_line += colored("======================", "magenta")


test_count = 0


def start_test_fold():
global test_count
sys.stdout.write('Running tests\n')
start_fold('test.{}'.format(test_count))
sys.stdout.write("Running tests\n")
start_fold(f"test.{test_count}")
test_count += 1


Expand All @@ -72,56 +76,62 @@ def start_test_fold():
p = subprocess.Popen(sys.argv[1:], stdout=subprocess.PIPE)

for line in p.stdout:
updated_line = line.decode('utf-8')
updated_line = line.decode("utf-8")
# remove non printable characters https://stackoverflow.com/a/8689826/1548052
filter(lambda x: x in printable, updated_line)
if re.match('Run dashboard with model Experimental', updated_line):
start_fold('Run tests')
updated_line = '{title}\n{line}'.format(title=colored('Running tests...', 'yellow', attrs=['bold']),
line=updated_line)

elif re.match('Test project /home/runner/QGIS/QGIS/build', updated_line):
if re.match("Run dashboard with model Experimental", updated_line):
start_fold("Run tests")
updated_line = "{title}\n{line}".format(
title=colored("Running tests...", "yellow", attrs=["bold"]),
line=updated_line,
)

elif re.match("Test project /home/runner/QGIS/QGIS/build", updated_line):
end_fold() # tag=Run tests
start_test_fold()

if re.search(r'\*\*\*Failed', updated_line) or re.search(r'\*\*\*Timeout', updated_line):
if re.search(r"\*\*\*Failed", updated_line) or re.search(
r"\*\*\*Timeout", updated_line
):
end_fold()
updated_line = colored(updated_line, 'red')
updated_line = colored(updated_line, "red")
in_failing_test = True

if in_failing_test:
if re.match(' Start', updated_line):
if re.match(" Start", updated_line):
start_test_fold()
in_failing_test = False
elif in_failure:
if re.match('PASS', updated_line) or re.match('Ran', updated_line):
if re.match("PASS", updated_line) or re.match("Ran", updated_line):
in_failure = False
else:
updated_line = colored(updated_line, 'yellow')
elif re.search(r'\*\*\* Segmentation fault', updated_line):
start_fold('segfault')
updated_line = colored(updated_line, 'magenta')
elif re.match(' Test failed: Segmentation fault', updated_line):
updated_line = colored(updated_line, "yellow")
elif re.search(r"\*\*\* Segmentation fault", updated_line):
start_fold("segfault")
updated_line = colored(updated_line, "magenta")
elif re.match(" Test failed: Segmentation fault", updated_line):
end_fold()

else:
if re.match(r'(FAIL|ERROR)[:\!].*', updated_line):
updated_line = colored(updated_line, 'yellow')
if re.match(r"(FAIL|ERROR)[:\!].*", updated_line):
updated_line = colored(updated_line, "yellow")
in_failure = True

if not in_failing_test and re.search('[0-9]+% tests passed, [0-9]+ tests failed out of', updated_line):
tests_failing = re.match(r'.* ([0-9]+) tests failed', updated_line).group(1)
updated_line += '\n::set-output name=TESTS_FAILING::{}'.format(tests_failing)
if not in_failing_test and re.search(
"[0-9]+% tests passed, [0-9]+ tests failed out of", updated_line
):
tests_failing = re.match(r".* ([0-9]+) tests failed", updated_line).group(1)
# updated_line += '\n::set-output name=TESTS_FAILING::{}'.format(tests_failing)
end_fold()

if re.search('100% tests passed', updated_line):
updated_line = colored(updated_line, 'green')
if re.search("100% tests passed", updated_line):
updated_line = colored(updated_line, "green")

if re.match('Submit files', updated_line):
start_fold('submit')
elif re.search('Test results submitted to', updated_line):
cdash_url = re.match(r'.*(http.*)$', updated_line).group(1)
updated_line += '\n::set-output name=CDASH_URL::{}'.format(cdash_url)
if re.match("Submit files", updated_line):
start_fold("submit")
elif re.search("Test results submitted to", updated_line):
cdash_url = re.match(r".*(http.*)$", updated_line).group(1)
# updated_line += '\n::set-output name=CDASH_URL::{}'.format(cdash_url)
end_fold()

sys.stdout.write(updated_line)
Expand Down
Loading

0 comments on commit cda55bc

Please sign in to comment.