CI: catch malformed test cases

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
This commit is contained in:
liushuyu 2022-04-22 16:34:20 -06:00
parent b74044fb62
commit 461bf1369f
No known key found for this signature in database
GPG Key ID: 23D1CE4534419437
2 changed files with 32 additions and 6 deletions

25
.github/emit_test_errors.pl vendored Executable file
View File

@ -0,0 +1,25 @@
#!/bin/perl -n
sub analyze_errors() {
/^(FAIL|ERROR|XPASS):\s([^:\s]+):?\s+(.+)/;
my $type = $1;
my $filename = $2;
my $message = $3;
my $line;
if ( !$type ) { return; }
if ( $message =~ /(at line (\d+))?.+(test for \w+, line (\d+))/g ) {
$line = $2 || $4;
}
my $command = "::error file=gcc/testsuite/$filename";
if ($line) {
$command = "$command,line=$line";
}
print "$command,title=Test failure ($type)::$message\n";
}
analyze_errors();

View File

@ -77,9 +77,10 @@ jobs:
- name: Check regressions
run: |
cd gccrs-build; \
if grep -e "unexpected" -e "unresolved" gcc/testsuite/rust/rust.sum;\
if grep -e "unexpected" -e "unresolved" -e "ERROR:" gcc/testsuite/rust/rust.sum;\
then \
echo "some tests are not correct"; \
echo "::error title=Regression test failed::some tests are not correct"; \
perl -n ../.github/emit_test_errors.pl < gcc/testsuite/rust/rust.sum; \
exit 1; \
else \
exit 0; \
@ -142,9 +143,9 @@ jobs:
- name: Check regressions
run: |
cd gccrs-build; \
if grep -e "unexpected" -e "unresolved" gcc/testsuite/rust/rust.sum;\
if grep -e "unexpected" -e "unresolved" -e "ERROR:" gcc/testsuite/rust/rust.sum;\
then \
echo "some tests are not correct"; \
echo "::error title=Regression test failed::some tests are not correct"; \
exit 1; \
else \
exit 0; \
@ -196,9 +197,9 @@ jobs:
- name: Check regressions
run: |
cd gccrs-build; \
if grep -e "unexpected" -e "unresolved" gcc/testsuite/rust/rust.sum;\
if grep -e "unexpected" -e "unresolved" -e "ERROR:" gcc/testsuite/rust/rust.sum;\
then \
echo "some tests are not correct"; \
echo "::error title=Regression test failed::some tests are not correct"; \
exit 1; \
else \
exit 0; \