Skip to content

Commit

Permalink
MDEV-14309 MTR tests require perl-Env which is not always in the defa…
Browse files Browse the repository at this point in the history
…ult installation

* don't use Env module in tests, use $ENV{xxx} instead
* collateral changes:
** $file in the error message was unset
** $file in the other error message was unset too :)
** source file arguments are conventionally upper-cased
** abort the test (die) on error, don't just echo/exit
  • Loading branch information
vuvova committed Dec 27, 2017
1 parent 462808f commit 1300627
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions mysql-test/include/truncate_file.inc
@@ -1,16 +1,11 @@
# truncate a giving file, all contents of the file are be cleared

if (!$file)
if (!$TRUNCATE_FILE)
{
--echo Please assign a file name to $file!!
exit;
die TRUNCATE_FILE is not set;
}

let TRUNCATE_FILE= $file;

perl;
use Env;
Env::import('TRUNCATE_FILE');
open FILE, '>', $TRUNCATE_FILE || die "Can not open file $file";
open FILE, '>', $ENV{TRUNCATE_FILE} or die "open(>$ENV{TRUNCATE_FILE}): $!";
close FILE;
EOF
2 changes: 1 addition & 1 deletion mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
Expand Up @@ -25,7 +25,7 @@ sync_slave_with_master;
connection master;
# Delete './master-bin.000001' from index file.
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
let $file= $MYSQLD_DATADIR/master-bin.index;
let TRUNCATE_FILE= $MYSQLD_DATADIR/master-bin.index;
source include/truncate_file.inc;

if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
Expand Down

0 comments on commit 1300627

Please sign in to comment.