File: run-test-suites.pl

package info (click to toggle)
0ad 0.0.26-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 130,460 kB
  • sloc: cpp: 261,824; ansic: 198,392; javascript: 19,067; python: 14,557; sh: 7,629; perl: 4,072; xml: 849; makefile: 741; java: 533; ruby: 229; php: 190; pascal: 30; sql: 21; tcl: 4
file content (35 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

use warnings;
use strict;

use utf8;
use open qw(:std utf8);

my @suites = grep { ! /\.(?:c|gcno)$/ } glob 'test_suite_*';
die "$0: no test suite found\n" unless @suites;

# in case test suites are linked dynamically
$ENV{'LD_LIBRARY_PATH'} = '../library';

my $prefix = $^O eq "MSWin32" ? '' : './';

my ($failed_suites, $total_tests_run);
for my $suite (@suites)
{
    print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " ";
    my $result = `$prefix$suite`;
    if( $result =~ /PASSED/ ) {
        print "PASS\n";
        my ($tests, $skipped) = $result =~ /([0-9]*) tests.*?([0-9]*) skipped/;
        $total_tests_run += $tests - $skipped;
    } else {
        $failed_suites++;
        print "FAIL\n";
    }
}

print "-" x 72, "\n";
print $failed_suites ? "FAILED" : "PASSED";
printf " (%d suites, %d tests run)\n", scalar @suites, $total_tests_run;
exit( $failed_suites ? 1 : 0 );