Commit 5e42c958 authored by Daniel Black's avatar Daniel Black Committed by elenst

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 716621db.

* 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: default avatarDaniel 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: https://github.com/mysql/mysql-server/pull/116#issuecomment-268479774)
Signed-off-by: default avatarDaniel Black <daniel.black@au.ibm.com>
parent 01d5d6db
......@@ -1054,7 +1054,7 @@ sub print_global_resfile {
resfile_global("gprof", $opt_gprof ? 1 : 0);
resfile_global("valgrind", $opt_valgrind ? 1 : 0);
resfile_global("callgrind", $opt_callgrind ? 1 : 0);
resfile_global("mem", $opt_mem ? 1 : 0);
resfile_global("mem", $opt_mem);
resfile_global("tmpdir", $opt_tmpdir);
resfile_global("vardir", $opt_vardir);
resfile_global("fast", $opt_fast ? 1 : 0);
......@@ -1194,7 +1194,7 @@ sub command_line_setup {
# Directories
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
'mem' => \$opt_mem,
'mem:s' => \$opt_mem,
'clean-vardir' => \$opt_clean_vardir,
'client-bindir=s' => \$path_client_bindir,
'client-libdir=s' => \$path_client_libdir,
......@@ -1452,12 +1452,17 @@ sub command_line_setup {
# Search through list of locations that are known
# to be "fast disks" to find a suitable location
# Use --mem=<dir> as first location to look.
my @tmpfs_locations= ($opt_mem,"/run/shm", "/dev/shm", "/tmp");
my @tmpfs_locations= ("/run/shm", "/dev/shm", "/tmp");
# Use $ENV{'MTR_MEM'} as first location to look (if defined)
unshift(@tmpfs_locations, $ENV{'MTR_MEM'}) if defined $ENV{'MTR_MEM'};
# however if the opt_mem was given a value, use this first
unshift(@tmpfs_locations, $opt_mem) if $opt_mem ne '';
foreach my $fs (@tmpfs_locations)
{
if ( -d $fs )
if ( -d $fs && ! -l $fs )
{
my $template= "var_${opt_build_thread}_XXXX";
$opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);
......@@ -6427,9 +6432,9 @@ Options to control directories to use
vardir=DIR The directory where files generated from the test run
is stored (default: ./var). Specifying a ramdisk or
tmpfs will speed up tests.
mem Run testsuite in "memory" using tmpfs or ramdisk
Attempts to find a suitable location
using a builtin list of standard locations
mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk
Attempts to use DIR first if specified else
uses a builtin list of standard locations
for tmpfs (/run/shm, /dev/shm, /tmp)
The option can also be set using environment
variable MTR_MEM=[DIR]
......
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