List:Commits« Previous MessageNext Message »
From:Patrick Crews Date:March 15 2009 4:25pm
Subject:bzr commit into mysql-5.0-bugteam branch (patrick.crews:2774) Bug#41307
View as plain text  
#At file:///Users/pcrews/usr/local/bin/data1/work/ndb_grep/mysql-5.0-bugteam/ based on revid:chad@stripped

 2774 Patrick Crews	2009-03-15
      Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to 'grep' call.
      
      Revised patch incorporating cleaner test code brought up during review.
      Removed the use of grep and accomplished same actions via SQL / use of the server.
      
      Runs as before on *nix systems and now runs on Windows without Cygwin as well.

    modified:
      mysql-test/include/ndb_backup.inc
      mysql-test/r/ndb_restore.result
      mysql-test/r/ndb_restore_print.result
=== modified file 'mysql-test/include/ndb_backup.inc'
--- a/mysql-test/include/ndb_backup.inc	2009-02-19 20:37:40 +0000
+++ b/mysql-test/include/ndb_backup.inc	2009-03-15 16:25:14 +0000
@@ -3,29 +3,49 @@
 # in test cases and can be reused.                   #
 ######################################################
 
-# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
-#            'grep' call
-# This test is disabled on Windows via the next line until the above bug is
-# resolved
---source include/not_windows.inc
-
 --exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
 
-# there is no neat way to find the backupid, this is a hack to find it...
-
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+# To find the backupid, we must dump this data to a table, and SELECT
+# what we want into an outfile.  This could be accomplished with grep, but
+# grep isn't Windows-portable
+
+--disable_query_log
+# create a table to help us out
+--disable_warnings # leave this on until done with the entire process
+# cleanup
+DROP TABLE IF EXISTS helper1;
+CREATE TABLE helper1(c1 VARCHAR(20));
+# dump raw data to file
+let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat;
+let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat;
+--error 0,1
+--remove_file $ndb_backup_file1
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1
+# load the table from the raw data file
+eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1;
+--remove_file $ndb_backup_file1
+# output what we need
+eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%'
+INTO OUTFILE '$ndb_backup_file2';
+# cleanup
+DROP TABLE helper1;
+--enable_warnings
+--enable_query_log
 
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
 
 DELETE FROM test.backup_info;
 
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval LOAD DATA INFILE '$ndb_backup_file2'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+--remove_file $ndb_backup_file2
 
 --replace_column 1 <the_backup_id>
 
 SELECT @the_backup_id:=backup_id FROM test.backup_info;
-
-let the_backup_id=`select @the_backup_id`;
+let $the_backup_id=`SELECT @the_backup_id`;
 
 DROP TABLE test.backup_info;
 

=== modified file 'mysql-test/r/ndb_restore.result'
--- a/mysql-test/r/ndb_restore.result	2008-01-22 13:18:47 +0000
+++ b/mysql-test/r/ndb_restore.result	2009-03-15 16:25:14 +0000
@@ -129,9 +129,11 @@ create table t7 engine=myisam as select 
 create table t8 engine=myisam as select * from t8_c;
 create table t9 engine=myisam as select * from t9_c;
 create table t10 engine=myisam as select * from t10_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
 DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
 SELECT @the_backup_id:=backup_id FROM test.backup_info;
 @the_backup_id:=backup_id
 <the_backup_id>

=== modified file 'mysql-test/r/ndb_restore_print.result'
--- a/mysql-test/r/ndb_restore_print.result	2007-03-08 08:37:53 +0000
+++ b/mysql-test/r/ndb_restore_print.result	2009-03-15 16:25:14 +0000
@@ -227,9 +227,11 @@ hex(h3)	NULL
 hex(i1)	NULL
 hex(i2)	NULL
 hex(i3)	NULL
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
 DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
 SELECT @the_backup_id:=backup_id FROM test.backup_info;
 @the_backup_id:=backup_id
 <the_backup_id>
@@ -261,9 +263,11 @@ create table t4 (pk int key, a int) engi
 insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
 insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
 insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
 DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
 SELECT @the_backup_id:=backup_id FROM test.backup_info;
 @the_backup_id:=backup_id
 <the_backup_id>
@@ -305,9 +309,11 @@ create table t1
 insert into t1 values(1, 8388607, 16777215);
 insert into t1 values(2, -8388608, 0);
 insert into t1 values(3, -1, 1);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
 DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
 SELECT @the_backup_id:=backup_id FROM test.backup_info;
 @the_backup_id:=backup_id
 <the_backup_id>


Attachment: [text/bzr-bundle] bzr/patrick.crews@sun.com-20090315162514-lsaxqjtw2zzw1b3c.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (patrick.crews:2774) Bug#41307Patrick Crews15 Mar