From cc628c61fb52e7e0f40117a699eafcce28825465 Mon Sep 17 00:00:00 2001 From: Patrick Crews Date: Thu, 19 Feb 2009 15:37:40 -0500 Subject: Bug#38831: 11 test cases fail on Windows due to missing commands Replaced Unix calls with mysql-test-run's built-in functions / SQL manipulation where possible. Replaced error codes with error names as well. Disabled two tests on Windows due to more complex Unix command usage See Bug#41307, Bug#41308 --- mysql-test/t/trigger-compat.test | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'mysql-test/t/trigger-compat.test') diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test index f2e350cb161..db410ba2f18 100644 --- a/mysql-test/t/trigger-compat.test +++ b/mysql-test/t/trigger-compat.test @@ -50,9 +50,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost; CREATE TABLE t1(num_value INT); CREATE TABLE t2(user_str TEXT); -CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 - FOR EACH ROW - INSERT INTO t2 VALUES(CURRENT_USER()); +CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER()); # # Remove definers from TRG file. @@ -61,8 +59,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 --echo --echo ---> patching t1.TRG... ---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG ---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG +# Here we remove definers. This is somewhat complex than the original test +# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not +# portable and we have to load the file into a table, exclude the definers line, +# then load the data to an outfile to accomplish the same effect + +--disable_query_log +--connection default +CREATE TABLE patch (a blob); +eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' INTO TABLE patch; +# remove original t1.TRG file so SELECT INTO OUTFILE won't fail +--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG +eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE + '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' +FROM patch; +DROP TABLE patch; +--connection wl2818_definer_con +--enable_query_log + # # Create a new trigger. -- cgit v1.2.1