Merge pull request #6027 from lrineau/Testsuite-fix_warnings_detection-GF

Fix detection of warnings in test results
This commit is contained in:
Laurent Rineau 2021-10-29 16:58:44 +02:00
commit 279db63ccb
2 changed files with 16 additions and 9 deletions

View File

@ -53,7 +53,7 @@ print_testresult()
# 'QMessageBox::warning'.
if grep -v -F 'CMake Warning at /usr/share/cmake/Modules/FindBoost' CompilerOutput_$1 ProgramOutput.*.$1 | grep -i -E -q '(^|[^a-zA-Z_,:-])warning'
then
if grep -v -F 'CMake Warning at /usr/share/cmake/Modules/FindBoost' CompilerOutput_$1 ProgramOutput.*.$1 | grep -i -E '(^|[^a-zA-Z_,:-])warning' | grep -i -q "include[/\]CGAL\|cmake"
if grep -v -F 'CMake Warning at /usr/share/cmake/Modules/FindBoost' CompilerOutput_$1 ProgramOutput.*.$1 | grep -i -E '(^|[^a-zA-Z_,:-])warning' | grep -i -q "include[/\]CGAL\|cmake\|CGAL warning"
then
RESULT="w"
else

View File

@ -76,19 +76,20 @@ for t_id in range(0, len(tests)):
labels.add(label)
tests_per_label[label].append(t)
warning_pattern=re.compile(r'(.*([^a-zA-Z_,:-])([^\d]\s)warning).*?(\[|\n)', flags=re.IGNORECASE)
warning_pattern=re.compile(r'(.*([^a-zA-Z_,:-])warning)', flags=re.IGNORECASE)
w_det=re.compile("warning");
filter_pattern=re.compile(r'cmake|cgal', flags=re.IGNORECASE);
with open_file_create_dir(result_file_name.format(dir=os.getcwd(),
tester=tester_name,
platform=platform_name), 'a+') as results:
for label, tests in tests_per_label.items():
counts={"n": 0, "w": 0, "t": 0}
result_for_label='y'
with open_file_create_dir("{}/error.txt".format(label), 'w') as error:
for t in tests:
print(" {result} {name} in {time} s : {value} ".format(result = "successful " if (t['Status'] == 'passed') else "ERROR: ", name = t['Name'], value = t['ExitValue'] if(t['ExitValue'] != "") else "SUCCESS" , time = t['ExecutionTime']), file=error)
if t['Status'] != 'passed':
result_for_label='n'
counts["n"]+=1
elif t['Output'] != None and w_det.search(t['Output']):
entries = re.split("\n+", t['Output'])
for entry in entries:
@ -96,15 +97,21 @@ with open_file_create_dir(result_file_name.format(dir=os.getcwd(),
if m:
n = filter_pattern.search(m.group(0))
if n:
result_for_label='w'
counts["w"]+=1
break;
else:
result_for_label='t'
counts["t"]+=1
with io.open("{}/ProgramOutput.{}".format(label, t['Name']), mode="w", encoding="utf-8") as f:
print("{}/ProgramOutput.{}".format(label, t['Name']))
f.write(t['Output'] if t['Output'] != None else "")
if counts["n"] > 0:
result_for_label='n'
elif counts["w"] > 0:
result_for_label='w'
elif counts["t"] > 0:
result_for_label='t'
print("{label} {result}".format(label=label, result=result_for_label), file=results)