Skip to content

Commit

Permalink
Store mysqld binaries upon demand, for further failure analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
elenst committed Jul 15, 2018
1 parent d3bbc6a commit 215a4bc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 4 deletions.
21 changes: 19 additions & 2 deletions runall-new.pl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
$notnull, $logfile, $logconf, $report_tt_logdir, $querytimeout, $no_mask,
$short_column_names, $strict_fields, $freeze_time, $wait_debugger, @debug_server,
$skip_gendata, $skip_shutdown, $galera, $use_gtid, $genconfig, $annotate_rules,
$restart_timeout, $gendata_advanced, $scenario);
$restart_timeout, $gendata_advanced, $scenario, $store_binaries);

my $gendata=''; ## default simple gendata

Expand Down Expand Up @@ -178,7 +178,8 @@
'use-gtid=s' => \$use_gtid,
'use_gtid=s' => \$use_gtid,
'annotate_rules|annotate-rules' => \$annotate_rules,
'scenario:s' => \$scenario
'scenario:s' => \$scenario,
'store-binaries|store_binaries' => \$store_binaries
);

if (defined $scenario) {
Expand Down Expand Up @@ -709,6 +710,22 @@
exit_test($diff_result);
} else {
# If test was not sucessfull or not rpl/multiple servers.

if ($gentest_result != STATUS_OK and $store_binaries) {
foreach my $i ($#server) {
my $file= $server[$i]->binary;
my $to= $vardirs[$i];
say("HERE: trying to copy $file to $to");
if (osWindows()) {
system("xcopy \"$file\" \"".$to."\"") if -e $file and $to;
$file =~ s/\.exe/\.pdb/;
system("xcopy \"$file\" \"".$to."\"") if -e $file and $to;
}
else {
system("cp $file ".$to) if -e $file and $to;
}
}
}
exit_test($gentest_result);
}

Expand Down
42 changes: 40 additions & 2 deletions runall.pl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
$start_dirty, $filter, $build_thread, $testname, $report_xml_tt,
$report_xml_tt_type, $report_xml_tt_dest, $notnull, $sqltrace,
$lcov, $transformers, $logfile, $logconf, $report_tt_logdir,$querytimeout,
$short_column_names, $strict_fields, $freeze_time, $wait_debugger, $appverif);
$short_column_names, $strict_fields, $freeze_time, $wait_debugger, $appverif,
$store_binaries);

my $threads = my $default_threads = 10;
my $queries = my $default_queries = 1000;
Expand Down Expand Up @@ -137,7 +138,8 @@
'report-tt-logdir=s' => \$report_tt_logdir,
'querytimeout=i' => \$querytimeout,
'wait-for-debugger' => \$wait_debugger,
'appverif:i' => \$appverif
'appverif:i' => \$appverif,
'store-binaries|store_binaries' => \$store_binaries
);

if ( osWindows() && !$debug )
Expand Down Expand Up @@ -573,6 +575,23 @@
"$ENV{RQG_HOME}gentest.pl ".join(' ', @gentest_options)) >> 8;
say("gentest.pl exited with exit status ".status2text($gentest_result). " ($gentest_result)");

if ($gentest_result != STATUS_OK and $store_binaries) {
foreach my $s (1..2)
{
last if not defined $vardirs[$s-1] or not defined $basedirs[$s-1];
if (osWindows()) {
my $file= _find( [$basedirs[$s-1]], ["sql/Debug","sql/RelWithDebInfo","sql/Release","bin"],'mysqld.exe' );
system("xcopy \"$file\" \"".$vardirs[$s-1]."\"") if -e $file;
$file= _find( [$basedirs[$s-1]], ["sql/Debug","sql/RelWithDebInfo","sql/Release","bin"],'mysqld.pdb' );
system("xcopy \"$file\" \"".$vardirs[$s-1]."\"") if -e $file;
}
else {
my $file= _find( [$basedirs[$s-1]], ["sql","libexec","bin","sbin"],'mysqld' );
system("cp $file ".$vardirs[$s-1]) if -e $file;
}
}
}

if ($lcov) {
say("Trying to generate a genhtml lcov report in ".tmpdir()."/rqg-lcov-".abs($$)." ...");
system("lcov --quiet --directory $basedirs[0] --capture --output-file ".tmpdir()."/lcov-rqg.info");
Expand Down Expand Up @@ -686,3 +705,22 @@ sub exit_test {
# exit
safe_exit($status);
}

sub _find {
my($bases, $subdir, @names) = @_;

foreach my $base (@$bases) {
foreach my $s (@$subdir) {
foreach my $n (@names) {
my $path = $base."/".$s."/".$n;
return $path if -f $path;
}
}
}
my $paths = "";
foreach my $base (@$bases) {
$paths .= join(",",map {"'".$base."/".$_."'"} @$subdir).",";
}
my $names = join(" or ", @names );
croak "Cannot find '$names' in $paths";
}

0 comments on commit 215a4bc

Please sign in to comment.