-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrex-test
executable file
·46 lines (34 loc) · 972 Bytes
/
rex-test
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
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd 'getcwd';
use Data::Dumper;
my $version = $ENV{REX_VERSION};
$ENV{"PATH"} = "$ENV{WORK_DIR}/rex/Rex-$version/bin:" . $ENV{PATH};
$ENV{"PERLLIB"} =
"$ENV{WORK_DIR}/rex/Rex-$version/lib:" . ( exists $ENV{PERLLIB} ? $ENV{PERLLIB} : "" );
$ENV{"PERL5LIB"} =
"$ENV{WORK_DIR}/rex/Rex-$version/lib:" . ( exists $ENV{PERL5LIB} ? $ENV{PERL5LIB} : "" );
my $debug = $ENV{debug} ? " -d " : "";
for my $file (@ARGV) {
my @out = `perl $ENV{WORK_DIR}/rex/Rex-$version/bin/rex $debug -cqw -Ff $file test`;
my @test_line;
my $found_end = 0;
my $p_count = 0;
for my $line (@out) {
chomp $line;
if ( $line =~ m/^(ok|not)/ ) {
push @test_line, $line;
}
if ( $line =~ m/ 1 \-/ ) {
$p_count++;
}
if ( $line =~ m/^1\.\./ ) {
$found_end++;
}
}
print join( "\n", @test_line );
if ( $found_end == $p_count ) {
print "\n1.." . scalar(@test_line) . "\n";
}
}