Loading client/mysqltest.c +20 −3 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ static my_bool disable_warnings= 0, disable_ps_warnings= 0; static my_bool disable_info= 1; static my_bool abort_on_error= 1; static my_bool server_initialized= 0; static my_bool is_windows= 0; static char **default_argv; static const char *load_default_groups[]= { "mysqltest", "client", 0 }; static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer; Loading Loading @@ -1676,7 +1676,7 @@ void do_exec(struct st_command *command) init_dynamic_string(&ds_cmd, 0, command->query_len+256, 256); /* Eval the command, thus replacing all environment variables */ do_eval(&ds_cmd, cmd, command->end, TRUE); do_eval(&ds_cmd, cmd, command->end, !is_windows); /* Check if echo should be replaced with "builtin" echo */ if (builtin_echo[0] && strncmp(cmd, "echo", 4) == 0) Loading @@ -1685,6 +1685,15 @@ void do_exec(struct st_command *command) replace(&ds_cmd, "echo", 4, builtin_echo, strlen(builtin_echo)); } #ifdef __WIN__ /* Replace /dev/null with NUL */ while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0) ; /* Replace "closed stdout" with non existing output fd */ while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0) ; #endif DBUG_PRINT("info", ("Executing '%s' as '%s'", command->first_argument, ds_cmd.str)); Loading Loading @@ -1844,7 +1853,14 @@ void do_system(struct st_command *command) init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256); /* Eval the system command, thus replacing all environment variables */ do_eval(&ds_cmd, command->first_argument, command->end, TRUE); do_eval(&ds_cmd, command->first_argument, command->end, !is_windows); #ifdef __WIN__ /* Replace /dev/null with NUL */ while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0) ; #endif DBUG_PRINT("info", ("running system command '%s' as '%s'", command->first_argument, ds_cmd.str)); Loading Loading @@ -5745,6 +5761,7 @@ int main(int argc, char **argv) init_builtin_echo(); #ifdef __WIN__ is_windows= 0; init_tmp_sh_file(); init_win_path_patterns(); #endif Loading mysql-test/r/mysqltest.result +0 −2 Original line number Diff line number Diff line Loading @@ -518,8 +518,6 @@ drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found mysqltest: At line 1: End of line junk detected: "write_file filename "; " mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' Loading mysql-test/t/mysqltest.test +35 −22 Original line number Diff line number Diff line Loading @@ -902,9 +902,9 @@ echo $d; # ---------------------------------------------------------------------------- # Test system # ---------------------------------------------------------------------------- system ls > /dev/null; #system ls > /dev/null; system echo "hej" > /dev/null; --system ls > /dev/null #--system ls > /dev/null --system echo "hej" > /dev/null; --error 1 Loading Loading @@ -1134,18 +1134,24 @@ EOF --error 1 --exec echo "{;" | $MYSQL_TEST 2>&1 --system echo "while (0)" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql while (0) echo hej; EOF --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --system echo "while (0)" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "{echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql while (0) {echo hej; EOF --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --system echo "while (0){" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql while (0){ echo hej; EOF --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 Loading Loading @@ -1244,28 +1250,34 @@ EOF --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1 # Repeat connect/disconnect, exceed max number of connections --system echo "let \$i=200;" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "{" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "}" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql let $i=200; while ($i) { connect (test_con1,localhost,root,,); disconnect test_con1; dec $i; } EOF --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 # Select disconnected connection --system echo "connect (test_con1,localhost,root,,);" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "connection test_con1;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql connect (test_con1,localhost,root,,); disconnect test_con1; connection test_con1; EOF --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 # Connection name already used --system echo "connect (test_con1,localhost,root,,);" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "connect (test_con1,localhost,root,,);" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql connect (test_con1,localhost,root,,); connect (test_con1,localhost,root,,); EOF --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 Loading Loading @@ -1510,8 +1522,9 @@ remove_file non_existing_file; --error 1 --exec echo "write_file filename ;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "write_file filename \";" | $MYSQL_TEST 2>&1 # Comment out this test as it confuses cmd.exe with unmatched " #--error 1 #--exec echo "write_file filename \";" | $MYSQL_TEST 2>&1 write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; Content for test_file1 Loading Loading
client/mysqltest.c +20 −3 Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ static my_bool disable_warnings= 0, disable_ps_warnings= 0; static my_bool disable_info= 1; static my_bool abort_on_error= 1; static my_bool server_initialized= 0; static my_bool is_windows= 0; static char **default_argv; static const char *load_default_groups[]= { "mysqltest", "client", 0 }; static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer; Loading Loading @@ -1676,7 +1676,7 @@ void do_exec(struct st_command *command) init_dynamic_string(&ds_cmd, 0, command->query_len+256, 256); /* Eval the command, thus replacing all environment variables */ do_eval(&ds_cmd, cmd, command->end, TRUE); do_eval(&ds_cmd, cmd, command->end, !is_windows); /* Check if echo should be replaced with "builtin" echo */ if (builtin_echo[0] && strncmp(cmd, "echo", 4) == 0) Loading @@ -1685,6 +1685,15 @@ void do_exec(struct st_command *command) replace(&ds_cmd, "echo", 4, builtin_echo, strlen(builtin_echo)); } #ifdef __WIN__ /* Replace /dev/null with NUL */ while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0) ; /* Replace "closed stdout" with non existing output fd */ while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0) ; #endif DBUG_PRINT("info", ("Executing '%s' as '%s'", command->first_argument, ds_cmd.str)); Loading Loading @@ -1844,7 +1853,14 @@ void do_system(struct st_command *command) init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256); /* Eval the system command, thus replacing all environment variables */ do_eval(&ds_cmd, command->first_argument, command->end, TRUE); do_eval(&ds_cmd, command->first_argument, command->end, !is_windows); #ifdef __WIN__ /* Replace /dev/null with NUL */ while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0) ; #endif DBUG_PRINT("info", ("running system command '%s' as '%s'", command->first_argument, ds_cmd.str)); Loading Loading @@ -5745,6 +5761,7 @@ int main(int argc, char **argv) init_builtin_echo(); #ifdef __WIN__ is_windows= 0; init_tmp_sh_file(); init_win_path_patterns(); #endif Loading
mysql-test/r/mysqltest.result +0 −2 Original line number Diff line number Diff line Loading @@ -518,8 +518,6 @@ drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found mysqltest: At line 1: End of line junk detected: "write_file filename "; " mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists' mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file' mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file' Loading
mysql-test/t/mysqltest.test +35 −22 Original line number Diff line number Diff line Loading @@ -902,9 +902,9 @@ echo $d; # ---------------------------------------------------------------------------- # Test system # ---------------------------------------------------------------------------- system ls > /dev/null; #system ls > /dev/null; system echo "hej" > /dev/null; --system ls > /dev/null #--system ls > /dev/null --system echo "hej" > /dev/null; --error 1 Loading Loading @@ -1134,18 +1134,24 @@ EOF --error 1 --exec echo "{;" | $MYSQL_TEST 2>&1 --system echo "while (0)" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql while (0) echo hej; EOF --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --system echo "while (0)" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "{echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql while (0) {echo hej; EOF --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 --system echo "while (0){" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "echo hej;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql while (0){ echo hej; EOF --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1 Loading Loading @@ -1244,28 +1250,34 @@ EOF --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1 # Repeat connect/disconnect, exceed max number of connections --system echo "let \$i=200;" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "{" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "}" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql let $i=200; while ($i) { connect (test_con1,localhost,root,,); disconnect test_con1; dec $i; } EOF --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 # Select disconnected connection --system echo "connect (test_con1,localhost,root,,);" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "connection test_con1;" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql connect (test_con1,localhost,root,,); disconnect test_con1; connection test_con1; EOF --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 # Connection name already used --system echo "connect (test_con1,localhost,root,,);" > $MYSQLTEST_VARDIR/tmp/mysqltest.sql --system echo "connect (test_con1,localhost,root,,);" >> $MYSQLTEST_VARDIR/tmp/mysqltest.sql --write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql connect (test_con1,localhost,root,,); connect (test_con1,localhost,root,,); EOF --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1 --exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1 Loading Loading @@ -1510,8 +1522,9 @@ remove_file non_existing_file; --error 1 --exec echo "write_file filename ;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "write_file filename \";" | $MYSQL_TEST 2>&1 # Comment out this test as it confuses cmd.exe with unmatched " #--error 1 #--exec echo "write_file filename \";" | $MYSQL_TEST 2>&1 write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; Content for test_file1 Loading