From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id DB23638207C8; Wed, 8 Jun 2022 12:37:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB23638207C8 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] CI: catch malformed test cases X-Act-Checkin: gcc X-Git-Author: liushuyu X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: b74044fb6278e373da607a8f1f5df2193ce27d65 X-Git-Newrev: 461bf1369fa0bb1c411ecdf649dbbe62f86d0070 Message-Id: <20220608123747.DB23638207C8@sourceware.org> Date: Wed, 8 Jun 2022 12:37:47 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 12:37:48 -0000 https://gcc.gnu.org/g:461bf1369fa0bb1c411ecdf649dbbe62f86d0070 commit 461bf1369fa0bb1c411ecdf649dbbe62f86d0070 Author: liushuyu Date: Fri Apr 22 16:34:20 2022 -0600 CI: catch malformed test cases Signed-off-by: Zixing Liu Diff: --- .github/emit_test_errors.pl | 25 +++++++++++++++++++++++++ .github/workflows/ccpp.yml | 13 +++++++------ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/emit_test_errors.pl b/.github/emit_test_errors.pl new file mode 100755 index 00000000000..cf8c3ad8042 --- /dev/null +++ b/.github/emit_test_errors.pl @@ -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(); diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 510e07cddd3..6fdfd9748b8 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -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; \