summaryrefslogtreecommitdiff
path: root/.github/emit_test_errors.pl
blob: cf8c3ad8042e049f40b2f8d600f81ecc9726af14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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();