blob: 3ec27c8c1db5d6c51ac5a52f4073686fc64a6555 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/env perl
# Run command, capture stdout and parse as TAP
use strict;
use warnings;
use 5.010;
use TAP::Parser;
my ($cmd) = @ARGV;
# travis-ci.org passes something wierd as stdin
# qemu hangs up when some ioctl() on stdin returns ERESTARTSYS when this is clearly not expected...
# so replace stdin with /dev/null
open(STDIN, '/dev/null');
my $out = `$cmd`;
my $result = ${^CHILD_ERROR_NATIVE};
my ($nplan, $npass, $nfail, $total) = (0,0,0,0);
if(length $out > 0) {
my $parser = TAP::Parser->new({source => $out});
while(my $result = $parser->next) {
print $result->as_string;
print "\n";
}
$nplan = $parser->tests_planned || 0;
$npass = $parser->passed;
$nfail = $parser->failed;
$total = $npass+$nfail;
} else {
print "<no stdout>\n";
}
# no tests pass. Assume early crash...
$result = 1 if $npass==0;
# some tests not run
$result = 1 if $nplan!=$total;
# some tests fail
$result = 1 if $nfail>0;
print <<EOF;
Ran $total/$nplan
Passed $npass/$nplan
Fail $nfail/$nplan
EOF
exit($result);
|