Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2064 06/03/08 23:27:30 msvensson@shellback.(none) +1 -0
Make mysql-test-run.pl restore the db(s) to a known state before continuing after test
case failure
mysql-test/mysql-test-run.pl
1.75 06/03/08 23:27:25 msvensson@shellback.(none) +58 -18
Take a snapshot of the var dir just after all db's have been installed and used that
snasphot to restore the db(s) to a known state after a test case has failed.
Thus avoiding subsequent test cases to fail because of previous test failures.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: msvensson
# Host: shellback.(none)
# Root: /home/msvensson/mysql/init_rm/my50-init_rm
--- 1.74/mysql-test/mysql-test-run.pl 2006-03-07 19:44:53 +01:00
+++ 1.75/mysql-test/mysql-test-run.pl 2006-03-08 23:27:25 +01:00
@@ -154,6 +154,7 @@
our $path_client_bindir;
our $path_language;
our $path_timefile;
+our $path_snapshot;
our $path_manager_log; # Used by mysqldadmin
our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
@@ -388,9 +389,10 @@
{
kill_and_cleanup();
mysql_install_db();
-
-# mysql_loadstd(); FIXME copying from "std_data" .frm and
-# .MGR but there are none?!
+ if ( $opt_force )
+ {
+ save_installed_db();
+ }
}
}
@@ -949,6 +951,9 @@
$path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
+
+ $path_snapshot= "$glob_mysql_test_dir/installed_db_snapshot_$opt_master_myport.tar.gz";
+
}
@@ -2024,10 +2029,9 @@
report_failure_and_restart($tinfo);
}
# Save info from this testcase run to mysqltest.log
+ my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile;
mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
- my $testcase_log= mtr_fromfile($path_timefile);
- mtr_tofile($path_mysqltest_log,
- $testcase_log);
+ mtr_tofile($path_mysqltest_log, $testcase_log);
}
# ----------------------------------------------------------------------
@@ -2041,6 +2045,44 @@
}
}
+#
+# Save a snapshot of the installed test db(s)
+# I.e take a snapshot of the var/ dir
+#
+sub save_installed_db () {
+
+ mtr_report("Saving snapshot of installed db(s)");
+ mtr_run("tar",
+ ["cpfz",
+ "$path_snapshot",
+ "$opt_vardir"],
+ "", "", "", "");
+}
+
+#
+# Restore snapshot of the installed test db(s)
+# if the snapshot exists
+#
+sub restore_installed_db () {
+
+ if ( -f $path_snapshot)
+ {
+ kill_and_cleanup();
+
+ mtr_report("Restoring snapshot of test db(s)");
+ mtr_run("tar",
+ ["xfz",
+ "$path_snapshot",
+ "-C", "/"],
+ "", "", "", "");
+ }
+ else
+ {
+ # No snapshot existed, just stop all processes
+ stop_masters_slaves();
+ }
+}
+
sub report_failure_and_restart ($) {
my $tinfo= shift;
@@ -2048,26 +2090,24 @@
mtr_report_test_failed($tinfo);
mtr_show_failed_diff($tinfo->{'name'});
print "\n";
- if ( ! $opt_force )
+ if ( $opt_force )
{
- my $test_mode= join(" ", @::glob_test_mode) || "default";
- print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
- print "To continue, re-run with '--force'.\n";
- if ( ! $opt_gdb and ! $glob_use_running_server and
- ! $opt_ddd and ! $glob_use_embedded_server )
- {
- stop_masters_slaves();
- }
- mtr_exit(1);
+ # Restore the snapshot of the installed test db
+ restore_installed_db();
+ print "Resuming Tests\n\n";
+ return;
}
- # FIXME always terminate on failure?!
+ my $test_mode= join(" ", @::glob_test_mode) || "default";
+ print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
+ print "To continue, re-run with '--force'.\n";
if ( ! $opt_gdb and ! $glob_use_running_server and
! $opt_ddd and ! $glob_use_embedded_server )
{
stop_masters_slaves();
}
- print "Resuming Tests\n\n";
+ mtr_exit(1);
+
}
| Thread |
|---|
| • bk commit into 5.0 tree (msvensson:1.2064) | msvensson | 8 Mar |