Skip to content

TG-945 Add default platform arguments and benchmarking to the perl script #1458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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