Use a tempdir name for the directory that var symlink points at, otherwise it can conflict

with another MTR_BUILD_THREAD=auto run
parent ec673b8a
...@@ -539,7 +539,7 @@ sub command_line_setup { ...@@ -539,7 +539,7 @@ sub command_line_setup {
if $opt_tmpdir; if $opt_tmpdir;
# Search through list of locations that are known # Search through list of locations that are known
# to be "fast disks" to list to find a suitable location # to be "fast disks" to find a suitable location
# Use --mem=<dir> as first location to look. # Use --mem=<dir> as first location to look.
my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp"); my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp");
...@@ -547,8 +547,8 @@ sub command_line_setup { ...@@ -547,8 +547,8 @@ sub command_line_setup {
{ {
if ( -d $fs ) if ( -d $fs )
{ {
$opt_mem= "$fs/var"; my $template= "var_${opt_mtr_build_thread}_XXXX";
$opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread; $opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);
last; last;
} }
} }
...@@ -772,7 +772,6 @@ sub set_mtr_build_thread_ports($) { ...@@ -772,7 +772,6 @@ sub set_mtr_build_thread_ports($) {
mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
print "got ".$mtr_build_thread."\n"; print "got ".$mtr_build_thread."\n";
} }
$opt_mtr_build_thread= $mtr_build_thread;
$ENV{MTR_BUILD_THREAD}= $mtr_build_thread; $ENV{MTR_BUILD_THREAD}= $mtr_build_thread;
# Calculate baseport # Calculate baseport
...@@ -1272,7 +1271,7 @@ sub remove_stale_vardir () { ...@@ -1272,7 +1271,7 @@ sub remove_stale_vardir () {
{ {
# var is a symlink # var is a symlink
if ( $opt_mem and readlink($opt_vardir) eq $opt_mem ) if ( $opt_mem )
{ {
# Remove the directory which the link points at # Remove the directory which the link points at
mtr_verbose("Removing " . readlink($opt_vardir)); mtr_verbose("Removing " . readlink($opt_vardir));
...@@ -1282,14 +1281,6 @@ sub remove_stale_vardir () { ...@@ -1282,14 +1281,6 @@ sub remove_stale_vardir () {
mtr_verbose("unlink($opt_vardir)"); mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir); unlink($opt_vardir);
} }
elsif ( $opt_mem )
{
# Just remove the "var" symlink
mtr_report(" - WARNING: Removing '$opt_vardir' symlink it's wrong");
mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir);
}
else else
{ {
# Some users creates a soft link in mysql-test/var to another area # Some users creates a soft link in mysql-test/var to another area
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment