summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-05-16 21:01:26 +0400
committerSergey Vojtovich <svoj@mariadb.org>2018-05-16 21:01:26 +0400
commitaa2e1ade17e656446c534c02e9cb0adab50b46e1 (patch)
tree9be2b14b73da3ec901e5260cc4b11185a27a4fd7
parent2b749a7bf4f6a6d70f05e8e4b42d088b397adea8 (diff)
downloadmariadb-git-aa2e1ade17e656446c534c02e9cb0adab50b46e1.tar.gz
(almost) sane core handling in mtr
Analyze core independently of max-save-datadir and max-save-core setting. Increment $num_saved_cores only if core was actually saved. "Move any core files from e.g. mysqltest" independently of max-save-datadir setting. Note: it may overwrite core from mysqld, which might not be desired (it did work this way even before).
-rwxr-xr-xmysql-test/mysql-test-run.pl81
1 files changed, 45 insertions, 36 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 0f915a8777a..de1871cbf03 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -637,50 +637,59 @@ sub run_test_server ($$$) {
my $worker_savename= basename($worker_savedir);
my $savedir= "$opt_vardir/log/$worker_savename";
+ # Move any core files from e.g. mysqltest
+ foreach my $coref (glob("core*"), glob("*.dmp"))
+ {
+ mtr_report(" - found '$coref', moving it to '$worker_savedir'");
+ move($coref, $worker_savedir);
+ }
+
+ find(
+ {
+ no_chdir => 1,
+ wanted => sub
+ {
+ my $core_file= $File::Find::name;
+ my $core_name= basename($core_file);
+
+ # Name beginning with core, not ending in .gz
+ if (($core_name =~ /^core/ and $core_name !~ /\.gz$/)
+ or (IS_WINDOWS and $core_name =~ /\.dmp$/))
+ {
+ # Ending with .dmp
+ mtr_report(" - found '$core_name'",
+ "($num_saved_cores/$opt_max_save_core)");
+
+ My::CoreDump->show($core_file, $exe_mysqld, $opt_parallel);
+
+ # Limit number of core files saved
+ if ($opt_max_save_core > 0 &&
+ $num_saved_cores >= $opt_max_save_core)
+ {
+ mtr_report(" - deleting it, already saved",
+ "$opt_max_save_core");
+ unlink("$core_file");
+ }
+ else
+ {
+ mtr_compress_file($core_file) unless @opt_cases;
+ ++$num_saved_cores;
+ }
+ }
+ }
+ },
+ $worker_savedir);
+
if ($opt_max_save_datadir > 0 &&
$num_saved_datadir >= $opt_max_save_datadir)
{
mtr_report(" - skipping '$worker_savedir/'");
rmtree($worker_savedir);
}
- else {
+ else
+ {
mtr_report(" - saving '$worker_savedir/' to '$savedir/'");
rename($worker_savedir, $savedir);
- # Move any core files from e.g. mysqltest
- foreach my $coref (glob("core*"), glob("*.dmp"))
- {
- mtr_report(" - found '$coref', moving it to '$savedir'");
- move($coref, $savedir);
- }
- if ($opt_max_save_core > 0) {
- # Limit number of core files saved
- find({ no_chdir => 1,
- wanted => sub {
- my $core_file= $File::Find::name;
- my $core_name= basename($core_file);
-
- # Name beginning with core, not ending in .gz
- if (($core_name =~ /^core/ and $core_name !~ /\.gz$/)
- or (IS_WINDOWS and $core_name =~ /\.dmp$/)){
- # Ending with .dmp
- mtr_report(" - found '$core_name'",
- "($num_saved_cores/$opt_max_save_core)");
-
- My::CoreDump->show($core_file, $exe_mysqld, $opt_parallel);
-
- if ($num_saved_cores >= $opt_max_save_core) {
- mtr_report(" - deleting it, already saved",
- "$opt_max_save_core");
- unlink("$core_file");
- } else {
- mtr_compress_file($core_file) unless @opt_cases;
- }
- ++$num_saved_cores;
- }
- }
- },
- $savedir);
- }
}
resfile_print_test();
$num_saved_datadir++;