Commit c61fb3c3 authored by unknown's avatar unknown

Replace win filename s with unix equivalent

Evaluate commands passed to "exec" and "system" to expand any $variables before executing command.


client/mysqltest.c:
  do_exec, do_system 
   - call do_eval on the command to be executed in order to expand any $variables
   - Remove old subst_env_var and my_popen, not needed anymore
  Rewrite 'replace_strings' into 'replace_strings_append'
   - copy whole strings instead of byte by byte copy
   - insert result directly inito dynamic_string, no need to check if out 
     string needs to be realloced for every byte.
   - Add comments and DBUG_PRINT's
  New function 'fix_win_paths', detect filenames in win format that should be converted 
  do_eval
  - Only set "escaped" if next char is \ or $
mysql-test/mysql-test-run.pl:
  Always pass path for DBUG .trace file in unix format
  Add search path client_debug to find debug compiled windows binaries
  Remove unused MYSQL_TEST_WINDIR and MASTER_WINMYSOCK
mysql-test/r/mysqldump.result:
  Update test result
mysql-test/t/client_xml.test:
  Use " instead of '
mysql-test/t/mysql_client_test.test:
  Remove the useless "exec echo" command
mysql-test/t/mysqltest.test:
  Escape $variables passed to --exec, that should not be evaluated in exec.
mysql-test/t/rpl000015.test:
  Remove unneccessary replace
mysql-test/t/system_mysql_db_fix.test:
  Call the "shell script" $MYSQL_FIX_SYSTEM_TABLE using --system
parent 1be9ba8a
This diff is collapsed.
......@@ -156,6 +156,7 @@ our $path_mysqltest_log;
our $path_slave_load_tmpdir; # What is this?!
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_vardir_unix; # Always unix formatted opt_vardir
our $opt_tmpdir; # A path but set directly on cmd line
our $opt_usage;
......@@ -640,7 +641,7 @@ sub command_line_setup () {
{
$opt_vardir= "$glob_mysql_test_dir/var";
}
$opt_vardir_unix= $opt_vardir;
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
......@@ -937,7 +938,8 @@ sub executable_setup () {
if ( $glob_win32 )
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/bin");
"$glob_basedir/client_debug",
"$glob_basedir/bin",);
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",);
......@@ -980,6 +982,7 @@ sub executable_setup () {
}
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"$path_client_bindir/mysql_client_test",
"/usr/bin/false");
}
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
......@@ -1093,14 +1096,11 @@ sub environment_setup () {
$ENV{'LC_COLLATE'}= "C";
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
$ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
$ENV{'MASTER_MYPORT1'}= $master->[1]->{'path_myport'};
$ENV{'SLAVE_MYPORT'}= $slave->[0]->{'path_myport'};
# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
$ENV{'MYSQL_TCP_PORT'}= 3306;
$ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
......@@ -1112,16 +1112,6 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
{
$ENV{$key}= `cygpath -w $ENV{$key}`;
$ENV{$key} =~ s,\\,\\\\,g;
chomp($ENV{$key});
}
}
# We are nice and report a bit about our settings
print "Using MTR_BUILD_THREAD = ",$ENV{MTR_BUILD_THREAD} || 0,"\n";
print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
......@@ -2171,12 +2161,12 @@ sub mysqld_arguments ($$$$$) {
if ( $type eq 'master' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_unix, $sidx);
}
if ( $type eq 'slave' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_unix, $sidx);
}
}
......@@ -2506,7 +2496,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_unix/log/mysqldump.trace";
}
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
......@@ -2515,7 +2505,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_unix/log/mysqldump.trace";
}
my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
"--port=$master->[0]->{'path_myport'} " .
......@@ -2523,7 +2513,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir/log/mysqlimport.trace";
" --debug=d:t:A,$opt_vardir_unix/log/mysqlimport.trace";
}
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
......@@ -2532,7 +2522,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir/log/mysqlshow.trace";
" --debug=d:t:A,$opt_vardir_unix/log/mysqlshow.trace";
}
my $cmdline_mysqlbinlog=
......@@ -2543,7 +2533,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir/log/mysqlbinlog.trace";
" --debug=d:t:A,$opt_vardir_unix/log/mysqlbinlog.trace";
}
my $cmdline_mysql=
......@@ -2675,7 +2665,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir);
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_unix);
}
if ( $opt_ssl_supported )
......
......@@ -2330,10 +2330,10 @@ drop table t1;
set global time_zone=default;
set time_zone=default;
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
......@@ -9,13 +9,13 @@ create table t1 (
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e 'select * from t1'
--exec $MYSQL --xml test -e "select * from t1"
--exec $MYSQL_DUMP --xml --skip-create test
--exec $MYSQL --xml test -e 'select count(*) from t1'
--exec $MYSQL --xml test -e 'select 1 < 2 from dual'
--exec $MYSQL --xml test -e 'select 1 > 2 from dual'
--exec $MYSQL --xml test -e 'select 1 & 3 from dual'
--exec $MYSQL --xml test -e 'select null from dual'
--exec $MYSQL --xml test -e "select count(*) from t1"
--exec $MYSQL --xml test -e "select 1 < 2 from dual"
--exec $MYSQL --xml test -e "select 1 > 2 from dual"
--exec $MYSQL --xml test -e "select 1 & 3 from dual"
--exec $MYSQL --xml test -e "select null from dual"
drop table t1;
......@@ -6,7 +6,6 @@
# var/log/mysql_client_test.trace
--disable_result_log
--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests
......
......@@ -429,7 +429,7 @@ echo ;
# Illegal use of echo
--error 1
--exec echo "echo $;" | $MYSQL_TEST 2>&1
--exec echo "echo \$;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -516,22 +516,22 @@ echo $novar1;
--exec echo "let ;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $=hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$=hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let hi=hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $1 hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$1 hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $m hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$m hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $ hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$ hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let =hi;" | $MYSQL_TEST 2>&1
......@@ -678,7 +678,7 @@ echo $i;
--error 1
--exec echo "inc i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=100; inc \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
inc $i; inc $i; inc $i; --echo $i
echo $i;
......@@ -706,7 +706,7 @@ echo $d;
--error 1
--exec echo "dec i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=100; dec \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -761,11 +761,11 @@ while ($i)
--error 1
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
--exec echo "while \\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while (\$i;" | $MYSQL_TEST 2>&1
--exec echo "while (\\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=1; while (\$i) dec \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=1; while (\\\$i) dec \\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "};" | $MYSQL_TEST 2>&1
--error 1
......@@ -877,22 +877,22 @@ select "a" as col1, "c" as col2;
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect
--exec echo "let \$i=100;" > var/tmp/con.sql
--exec echo "while (\$i)" >> var/tmp/con.sql
--exec echo "let \\\$i=100;" > var/tmp/con.sql
--exec echo "while (\\\$i)" >> var/tmp/con.sql
--exec echo "{" >> var/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> var/tmp/con.sql
--exec echo " disconnect test_con1; " >> var/tmp/con.sql
--exec echo " dec \$i; " >> var/tmp/con.sql
--exec echo " dec \\\$i; " >> var/tmp/con.sql
--exec echo "}" >> var/tmp/con.sql
--exec echo "source var/tmp/con.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
--exec echo "let \$i=200;" > var/tmp/con.sql
--exec echo "while (\$i)" >> var/tmp/con.sql
--exec echo "let \\\$i=200;" > var/tmp/con.sql
--exec echo "while (\\\$i)" >> var/tmp/con.sql
--exec echo "{" >> var/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> var/tmp/con.sql
--exec echo " disconnect test_con1; " >> var/tmp/con.sql
--exec echo " dec \$i; " >> var/tmp/con.sql
--exec echo " dec \\\$i; " >> var/tmp/con.sql
--exec echo "}" >> var/tmp/con.sql
--error 1
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
......@@ -1001,7 +1001,7 @@ select "this will be executed";
#
# Test that a test file that does not generate any output fails.
#
--exec echo "let \$i= 1;" > $MYSQL_TEST_DIR/var/tmp/query.sql
--exec echo "let \\\$i= 1;" > $MYSQL_TEST_DIR/var/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x var/tmp/query.sql 2>&1
......
......@@ -12,7 +12,7 @@ show slave status;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TCP_PORT MASTER_PORT
--replace_result $MYSQL_TCP_PORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT
......
......@@ -77,7 +77,8 @@ type=ISAM;
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > /dev/null
-- enable_query_log
-- enable_result_log
......
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