Skip to content

Commit

Permalink
Merge pull request #1458 from LAJW/perl-platform
Browse files Browse the repository at this point in the history
TG-945 Add default platform arguments and benchmarking to the perl script
  • Loading branch information
romainbrenguier authored Oct 30, 2017
2 parents 5196e40 + 4da5a94 commit ee4a887
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions regression/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,21 @@ ($)
return @data;
}

sub test($$$$$$) {
my ($name, $test, $t_level, $cmd, $ign, $dry_run) = @_;
sub test($$$$$$$) {
my ($name, $test, $t_level, $cmd, $ign, $dry_run, $defines) = @_;
my ($level, $input, $options, $grep_options, @results) = load("$test");
my @keys = keys %{$defines};
foreach my $key (@keys) {
my $value = $defines->{$key};
$options =~ s/(\$$key$|\$$key )/$value /g;
}
if (scalar @keys) {
foreach my $word (split(/\s/, $options)) {
if ((substr($word, 0, 1) cmp '$') == 0) {
print "$name: variable \"$word\" not replaced; consider passing \"-D$word\"=...";
}
}
}

# If the 4th line is activate-multi-line-match we enable multi-line checks
if($grep_options ne "activate-multi-line-match") {
Expand Down Expand Up @@ -227,6 +239,8 @@ ($$$$)
-T thorough: run expensive tests
-F future: run checks for future features
-K known: run tests associated with known bugs
-D <key=value> Define - replace \$key string with "value" string in
test descriptors
test.pl expects a test.desc file in each subdirectory. The file test.desc
Expand Down Expand Up @@ -258,10 +272,12 @@ ($$$$)
}

use Getopt::Std;
use Getopt::Long qw(:config pass_through bundling);
$main::VERSION = 0.1;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
our ($opt_c, $opt_i, $opt_j, $opt_n, $opt_h, $opt_C, $opt_T, $opt_F, $opt_K); # the variables for getopt
our ($opt_c, $opt_i, $opt_j, $opt_n, $opt_h, $opt_C, $opt_T, $opt_F, $opt_K, %defines); # the variables for getopt
$opt_j = 0;
GetOptions("D=s", \%defines);
getopts('c:i:j:nhCTFK') or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
$opt_c or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
(!$opt_j || $has_thread_pool) or &main::HELP_MESSAGE(\*STDOUT, "", $main::VERSION, "");
Expand Down Expand Up @@ -298,15 +314,18 @@ ($)
my @files = glob "$test/*.desc";
for (0..$#files){
defined($pool) or print " Running $files[$_]";
$failed_skipped = test($test, $files[$_], $t_level, $opt_c, $opt_i, $dry_run);
my $start_time = time();
$failed_skipped = test(
$test, $files[$_], $t_level, $opt_c, $opt_i, $dry_run, \%defines);
my $runtime = time() - $start_time;

lock($skips);
defined($pool) and print " Running $test $files[$_]";
if(2 == $failed_skipped) {
$skips++;
print " [SKIPPED]\n";
} elsif(0 == $failed_skipped) {
print " [OK]\n";
print " [OK] in $runtime seconds\n";
} else {
$failures++;
print " [FAILED]\n";
Expand Down

0 comments on commit ee4a887

Please sign in to comment.