mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / bootstrap.test
blobdb89269b35d67975b3050f5848b0e59bacdd5a54
2 # test mysqld in bootstrap mode
4 --disable_warnings
5 drop table if exists t1;
6 --enable_warnings
9 # Add the datadir to the bootstrap command
10 let $MYSQLD_DATADIR= `select @@datadir`;
11 let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR;
14 # Check that --bootstrap reads from stdin
16 --write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
17 use test;
18 CREATE TABLE t1(a int);
19 EOF
20 --exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
21 drop table t1;
22 remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
25 # Check that --bootstrap of file with SQL error returns error
27 --write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
28 use test;
29 CREATE TABLE t1;
30 EOF
31 --error 1
32 --exec $MYSQLD_BOOTSTRAP_CMD  < $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
33 # Table t1 should not exists
34 --error 1051
35 drop table t1;
36 remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
39 # Bootstrap with a query larger than 2*thd->net.max_packet
41 set @my_max_allowed_packet= @@max_allowed_packet;
42 set global max_allowed_packet=100*@@max_allowed_packet;
43 --disable_query_log
44 create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b;
45 eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
46 --enable_query_log
47 --error 1
48 --exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
49 remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql;
51 set global max_allowed_packet=@my_max_allowed_packet;
52 drop table t1;