File: 00.re2-tests.t

package info (click to toggle)
libre-engine-re2-perl 0.18%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 440 kB
  • sloc: cpp: 270; perl: 80; makefile: 2; sh: 1
file content (37 lines) | stat: -rw-r--r-- 940 bytes parent folder | download | duplicates (5)
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
use Test::More;
no warnings;

plan skip_all => "Only when likning against local library";

# Avoid running for everyone, these tests are quite slow, but useful for CPAN
# testers to run. cpanminus sets automated testing when it isn't, so ignore
# in that case too.
plan skip_all => "Only for automated tests"
  unless $ENV{AUTOMATED_TESTING} and not $ENV{PERL5_CPANM_IS_RUNNING};

my $make = $ENV{MAKE} || "make";

my @results = qx{$make re2-tests};

for(@results) {
  if(my($test, $result, $diag) = $_ =~ /^(obj[^ ]+)\s+(PASS|FAIL)(.*)/) {
    if($result eq 'PASS') {
      pass $test;
    } else {
      fail "$test$diag";

      if($diag =~ /output in (.*)/) {
        my $file = "re2/$1";
        open my $log_fh, "<", $file or do { diag "$file: $!"; next };
        diag <$log_fh>;
      }
    }
  }
}

if("@results" !~ /PASS|FAIL/) {
  diag @results;
  plan skip_all => "Unable to compile RE2 tests for some reason";
}

done_testing;