Skip to content

Commit 5e42c95

Browse files
grooverdanelenst
authored andcommitted
MDEV-11619: mtr --mem and $MTR_MEM support in sane and consistent manner (10.0) (#289)
* Revert "Make --mem a pure flag. If there is need to specifically set the location" This reverts commit 716621d. * MDEV-11619: mtr: when --mem is pure flag, conflicts with $MTR_MEM Conflicts occurs when MTR_MEM=/xxx/yy ./mtr --mem is invoked. Here the --mem option overrides opt_mem leaving the default path to be chosen. This change makes when MTR_MEM set, opt_mem, the flag, is also set. Both the environment and flag can no be set without conflicting. Signed-off-by: Daniel Black <daniel.black@au.ibm.com> * MDEV-11619: if opt_mem is a path include it first * MDEV-11619: MTR_MEM locations - don't follow symlinks From Bjorn Munch it seems symlinks can confuse some tests. Lets just avoid those. (ref: mysql/mysql-server#116 (comment)) Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
1 parent 01d5d6d commit 5e42c95

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ sub print_global_resfile {
10541054
resfile_global("gprof", $opt_gprof ? 1 : 0);
10551055
resfile_global("valgrind", $opt_valgrind ? 1 : 0);
10561056
resfile_global("callgrind", $opt_callgrind ? 1 : 0);
1057-
resfile_global("mem", $opt_mem ? 1 : 0);
1057+
resfile_global("mem", $opt_mem);
10581058
resfile_global("tmpdir", $opt_tmpdir);
10591059
resfile_global("vardir", $opt_vardir);
10601060
resfile_global("fast", $opt_fast ? 1 : 0);
@@ -1194,7 +1194,7 @@ sub command_line_setup {
11941194
# Directories
11951195
'tmpdir=s' => \$opt_tmpdir,
11961196
'vardir=s' => \$opt_vardir,
1197-
'mem' => \$opt_mem,
1197+
'mem:s' => \$opt_mem,
11981198
'clean-vardir' => \$opt_clean_vardir,
11991199
'client-bindir=s' => \$path_client_bindir,
12001200
'client-libdir=s' => \$path_client_libdir,
@@ -1452,12 +1452,17 @@ sub command_line_setup {
14521452

14531453
# Search through list of locations that are known
14541454
# to be "fast disks" to find a suitable location
1455-
# Use --mem=<dir> as first location to look.
1456-
my @tmpfs_locations= ($opt_mem,"/run/shm", "/dev/shm", "/tmp");
1455+
my @tmpfs_locations= ("/run/shm", "/dev/shm", "/tmp");
1456+
1457+
# Use $ENV{'MTR_MEM'} as first location to look (if defined)
1458+
unshift(@tmpfs_locations, $ENV{'MTR_MEM'}) if defined $ENV{'MTR_MEM'};
1459+
1460+
# however if the opt_mem was given a value, use this first
1461+
unshift(@tmpfs_locations, $opt_mem) if $opt_mem ne '';
14571462

14581463
foreach my $fs (@tmpfs_locations)
14591464
{
1460-
if ( -d $fs )
1465+
if ( -d $fs && ! -l $fs )
14611466
{
14621467
my $template= "var_${opt_build_thread}_XXXX";
14631468
$opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);
@@ -6427,9 +6432,9 @@ ($)
64276432
vardir=DIR The directory where files generated from the test run
64286433
is stored (default: ./var). Specifying a ramdisk or
64296434
tmpfs will speed up tests.
6430-
mem Run testsuite in "memory" using tmpfs or ramdisk
6431-
Attempts to find a suitable location
6432-
using a builtin list of standard locations
6435+
mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk
6436+
Attempts to use DIR first if specified else
6437+
uses a builtin list of standard locations
64336438
for tmpfs (/run/shm, /dev/shm, /tmp)
64346439
The option can also be set using environment
64356440
variable MTR_MEM=[DIR]

0 commit comments

Comments
 (0)