From 61c423a2bd186bd6488df89216238a6e81a76df6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Jun 2007 18:21:20 +0200 Subject: [PATCH 1/2] Change "exec rm" to "remove_file" mysql-test/t/sp.test: Change "exec rm" to "remove_file" Change two "remove file if exists" to "check that file not exist" --- mysql-test/include/have_outfile.inc | 2 +- mysql-test/t/sp.test | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/mysql-test/include/have_outfile.inc b/mysql-test/include/have_outfile.inc index 10f093ec3ef..ae4a2723840 100644 --- a/mysql-test/include/have_outfile.inc +++ b/mysql-test/include/have_outfile.inc @@ -1,5 +1,5 @@ -- require r/have_outfile.require disable_query_log; select load_file(concat(@tmpdir,"/outfile.test")); ---exec rm $MYSQLTEST_VARDIR/tmp/outfile.test +--remove_file $MYSQLTEST_VARDIR/tmp/outfile.test enable_query_log; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index c94a526e10c..460c10d88d0 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -705,9 +705,11 @@ begin insert into test.t1 values (concat(x, "2"), y+2); end| ---system rm -f $MYSQLTEST_VARDIR/tmp/spout +# Check that file does not exists +--error 1 +--file_exists $MYSQLTEST_VARDIR/tmp/spout call into_outfile("ofile", 1)| ---system rm -f $MYSQLTEST_VARDIR/tmp/spout +--remove_file $MYSQLTEST_VARDIR/tmp/spout delete from t1| drop procedure into_outfile| @@ -722,9 +724,11 @@ begin insert into test.t1 values (concat(x, "2"), y+2); end| ---system rm -f $MYSQLTEST_VARDIR/tmp/spdump +# Check that file does not exists +--error 1 +--file_exists $MYSQLTEST_VARDIR/tmp/spdump call into_dumpfile("dfile", 1)| ---system rm -f $MYSQLTEST_VARDIR/tmp/spdump +--remove_file $MYSQLTEST_VARDIR/tmp/spdump delete from t1| drop procedure into_dumpfile| From 0870afe37de6bac78e8099eecc175827d274c1f3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Jun 2007 10:26:20 +0200 Subject: [PATCH 2/2] Bug#28356 Exec'ing "diff" from "mysqltest" loses the output, no information available - Use SQL for diffing master and slave mysql-test/r/rpl_misc_functions.result: Dump t1 on slave and load it back into temporary table on master to allow comapre with SQL mysql-test/t/rpl_misc_functions.test: Dump t1 on slave and load it back into temporary table on master to allow comapre with SQL --- mysql-test/r/rpl_misc_functions.result | 16 +++++++--- mysql-test/t/rpl_misc_functions.test | 42 ++++++++++++++++---------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/rpl_misc_functions.result b/mysql-test/r/rpl_misc_functions.result index 526414cec9c..ca7403316b1 100644 --- a/mysql-test/r/rpl_misc_functions.result +++ b/mysql-test/r/rpl_misc_functions.result @@ -40,7 +40,15 @@ CALL test_replication_sp2(); INSERT INTO t1 VALUES (test_replication_sf()); INSERT INTO t1 VALUES (test_replication_sf()); INSERT INTO t1 VALUES (test_replication_sf()); -DROP PROCEDURE IF EXISTS test_replication_sp1; -DROP PROCEDURE IF EXISTS test_replication_sp2; -DROP FUNCTION IF EXISTS test_replication_sf; -DROP TABLE IF EXISTS t1; +select * from t1 into outfile "../tmp/t1_slave.txt"; +create temporary table t1_slave select * from t1 where 1=0; +load data infile '../tmp/t1_slave.txt' into table t1_slave; +select count(*) into @aux from t1, t1_slave +where ABS(t1.col_a - t1_slave.col_a) < 0.0001 ; +SELECT @aux; +@aux +12 +DROP PROCEDURE test_replication_sp1; +DROP PROCEDURE test_replication_sp2; +DROP FUNCTION test_replication_sf; +DROP TABLE t1, t1_slave; diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test index f00beff583a..b87fff919b2 100644 --- a/mysql-test/t/rpl_misc_functions.test +++ b/mysql-test/t/rpl_misc_functions.test @@ -77,27 +77,37 @@ INSERT INTO t1 VALUES (test_replication_sf()); INSERT INTO t1 VALUES (test_replication_sf()); INSERT INTO t1 VALUES (test_replication_sf()); -# Record the results of the query on the master ---exec $MYSQL --port=$MASTER_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql - --sync_slave_with_master -# Record the results of the query on the slave ---exec $MYSQL --port=$SLAVE_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql +# Dump table on slave +select * from t1 into outfile "../tmp/t1_slave.txt"; -# Compare the results from the master to the slave. ---exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql +# Load data from slave into temp table on master +connection master; +create temporary table t1_slave select * from t1 where 1=0; +load data infile '../tmp/t1_slave.txt' into table t1_slave; +--remove_file $MYSQLTEST_VARDIR/tmp/t1_slave.txt + +# Compare master and slave temp table, use subtraction +# for floating point comparison of "double" +select count(*) into @aux from t1, t1_slave +where ABS(t1.col_a - t1_slave.col_a) < 0.0001 ; +SELECT @aux; +if (`SELECT @aux <> 12 OR @aux IS NULL`) +{ + --echo # ERROR: We expected to get count(*) = 12. + SELECT col_a FROM t1; + SELECT col_a FROM t1_slave; + --echo # abort + exit; +} # Cleanup connection master; ---disable_warnings -DROP PROCEDURE IF EXISTS test_replication_sp1; -DROP PROCEDURE IF EXISTS test_replication_sp2; -DROP FUNCTION IF EXISTS test_replication_sf; -DROP TABLE IF EXISTS t1; ---enable_warnings +DROP PROCEDURE test_replication_sp1; +DROP PROCEDURE test_replication_sp2; +DROP FUNCTION test_replication_sf; +DROP TABLE t1, t1_slave; --sync_slave_with_master -# If all is good, when can cleanup our dump files. ---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql ---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql +