~ubuntu-branches/ubuntu/natty/mysql-5.1/natty

« back to all changes in this revision

Viewing changes to mysql-test/t/mysqltest.test

Tags: 5.1.54-1ubuntu1
* Synchronize from Debian Experimental:
* Merge from debian unstable:
  + debian/control:
     * Update maintainer according to spec.
     * Move section from "misc" to "database".
     * Added libmysqlclient16-dev an empty transitional package. 
     * Added mysql-client-core-5.1 package.
     * Suggest mailx for mysql-server-5.1
     * Add mysql-testsuite package so you can run the testsuite seperately.
  + debian/additions/my.cnf:
    * Remove language options. Error message files are located in a different directory in Mysql
      5.0. Setting the language option to use /usr/share/mysql/english breaks Mysql 5.0. Both 5.0
      and 5.1 use a different value that works. (LP: #316974)
  + Add apparmor profile:
    + debian/apparmor-profile: apparmor-profile
    + debian/rules, debian/mysql-server-5.1.files: install apparmor profile
    + debian/mysql-server-5.1.dirs: add etc/apparmor.d/fore-complain
    + debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on purge.
    + debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    + debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    + debian/mysql-server-5.1.postinst: reload apparmor profiles
  * Convert the package from sysvinit to upstart:
    + debian/mysql-server-5.1.mysql.upstart: Add upstart script.
    + debian/mysql-server-5.1.mysql.init: Dropped, unused now with upstart.
    + debian/additions/mysqld_safe_syslog.cnf: Dropped, unused now with upstart.
    + debian/additons/my.cnf: Remove pid declaration and setup error logging to /var/log/mysql since
      we're not piping anything around logger anymore.
    + debian/rules, debian/mysql-server-5.1.logcheck.ignore.{paranoid,worstation},
      debian/mysql-server-5.1.logcheck.ignore.server: : Remove references to mysqld_safe
    + debian/patches/38_scripts_mysqld_safe.sh_signals.dpatch: Dropped
  * Added -fno-strict-aliasing to CFLAGS to get around mysql testsuite build failures.
  * Add Apport hook (LP: #354188):
    + debian/mysql-server-5.1.py: apport package hook
    + debian/rules: Make it installable
  * debian/mysql-server-5.1.mysql-server.logrotate: Check to see if mysql is running before
    running logrotate. (LP: #513135)
  * Make the testsuite installable. (LP: #530752)
    + debian/mysql-server-5.1.files, debian/rules: install apport package hook
  * debian/mysql-server-5.1.preinst: Set mysql user's home directory
    to /nonexistent to protect against having the /var/lib/mysql
    user-writeable. If an attacker can trick mysqld into creating
    dot files in the home directory, he could do .rhost-like attacks
    on the system. (LP: #293258)
  * debian/control: mysql-client-5.1 should depend on mysql-core-client-5.1.
    (LP: #590952)
  * debian/mysql-server.5.1.postinst: Specify the mysql user when installing 
    the mysql databases. (LP: #591875)
  * Installing mysql_config_pic in /usr/bin so users of libmysqld-pic
    can extract the appropriate compile flags. (LP: #605021) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
326
326
--exec echo "disable_abort_on_error; error 1000; select 3 from t1; error 1000; select 3 from t1;" | $MYSQL_TEST  2>&1
327
327
 
328
328
# ----------------------------------------------------------------------------
 
329
# Check some non-query statements that would fail
 
330
# ----------------------------------------------------------------------------
 
331
--exec illegal_command
 
332
--cat_file does_not_exist
 
333
--perl
 
334
  exit(2);
 
335
EOF
 
336
 
 
337
# ----------------------------------------------------------------------------
329
338
# Switch the abort on error on and check the effect on $mysql_errno
330
339
# ----------------------------------------------------------------------------
331
340
--error ER_PARSE_ERROR
485
494
--error 1
486
495
--exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1
487
496
 
 
497
#
 
498
# Extra text after ``
 
499
#
 
500
# Cannot use exec echo here as ` may or may not need to be escaped
 
501
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
 
502
let $x= `select 1` BOO ;
 
503
EOF
 
504
--error 1
 
505
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
 
506
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
 
507
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
 
508
--let $x= `select 1`;
 
509
EOF
 
510
--error 1
 
511
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
 
512
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
 
513
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
 
514
# Missing ; in next line should be detected and cause failure
 
515
let $x= `select 1`
 
516
let $x= 2;
 
517
echo $x;
 
518
EOF
 
519
--error 1
 
520
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
 
521
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
 
522
 
488
523
 
489
524
# Allow trailing # comment
490
525
--sleep 1 # Wait for insert delayed to be executed.
692
727
let $cat=ba\\\$cat\\\$cat;
693
728
echo Not a banana: $cat;
694
729
 
 
730
# Bug #55413 would cause this to fail
 
731
let $escape= with\`some\"escaped\'quotes;
 
732
echo $escape;
 
733
 
 
734
--let $escape= with\`some\"escaped\'quotes
 
735
echo $escape;
 
736
 
 
737
# This only works with "--let" syntax
 
738
--let $tick= single'tick`backtick
 
739
echo $tick;
695
740
 
696
741
# Test illegal uses of let
697
742
 
809
854
echo $var2;
810
855
EOF
811
856
 
 
857
create table t1 (a varchar(100));
 
858
insert into t1 values ('`select 42`');
 
859
let $a= `select * from t1`;
 
860
# This should output `select 42`, not evaluate it again to 42
 
861
echo $a;
 
862
drop table t1;
 
863
 
812
864
--error 1
813
865
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
814
866
 
863
915
}
864
916
 
865
917
# Test source in an if in a while which is false on 1st iteration
866
 
# Also test --error in same context
 
918
# Also test --error and --disable_abort_on_error in same context
867
919
let $outer= 2; # Number of outer loops
868
920
let $ifval= 0; # false 1st time
869
921
while ($outer)
874
926
    --source $MYSQLTEST_VARDIR/tmp/sourced.inc
875
927
    --error ER_NO_SUCH_TABLE
876
928
    SELECT * from nowhere;
 
929
    --disable_abort_on_error
 
930
# Statement giving a different error, to make sure we don't mask it
 
931
    SELECT * FROM nowhere else;
 
932
    --enable_abort_on_error
877
933
  }
878
934
  dec $outer;
879
935
  inc $ifval;
1082
1138
{
1083
1139
  echo Counter is not 0, (counter=10);
1084
1140
}
 
1141
if (! $counter)
 
1142
{
 
1143
  let $counter=5;
 
1144
}
 
1145
echo Counter should still be 10, is $counter;
1085
1146
let $counter=0;
1086
1147
if($counter)
1087
1148
{
1091
1152
{
1092
1153
  echo Counter is not 0, (counter=0);
1093
1154
}
 
1155
if (! $counter)
 
1156
{
 
1157
  echo Not space var works;
 
1158
}
 
1159
 
 
1160
# ----------------------------------------------------------------------------
 
1161
# Test if with some non-numerics
 
1162
# ----------------------------------------------------------------------------
 
1163
 
 
1164
let $counter=alpha;
 
1165
if ($counter)
 
1166
{
 
1167
  echo Counter is true, (counter=alpha);
 
1168
}
 
1169
let $counter=   ;
 
1170
if ($counter)
 
1171
{
 
1172
  echo oops, space is true;
 
1173
}
 
1174
let $counter=-0;
 
1175
if ($counter)
 
1176
{
 
1177
  echo oops, -0 is true;
 
1178
}
 
1179
if (beta)
 
1180
{
 
1181
  echo Beta is true;
 
1182
}
 
1183
let $counter=gamma;
 
1184
while ($counter)
 
1185
{
 
1186
  echo while with string, only once;
 
1187
  let $counter=000;
 
1188
}
1094
1189
 
1095
1190
# ----------------------------------------------------------------------------
1096
1191
# Test while, { and }
1388
1483
 
1389
1484
# Repeat connect/disconnect
1390
1485
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
1391
 
let $i=100;
1392
 
while ($i)
1393
 
{
1394
 
  connect (test_con1,localhost,root,,);
1395
 
  disconnect test_con1;
1396
 
  dec $i;
1397
 
}
1398
 
EOF
1399
 
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK; exit;" | $MYSQL_TEST 2>&1
1400
 
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
1401
 
 
1402
 
# Repeat connect/disconnect
1403
 
--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
1404
1486
let $i=200;
1405
1487
while ($i)
1406
1488
{
1408
1490
 disconnect test_con1;
1409
1491
 dec $i;
1410
1492
}
 
1493
echo 200 connects succeeded;
1411
1494
EOF
1412
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1413
 
--error 1
1414
1495
--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
1415
1496
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
1416
1497
 
1437
1518
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
1438
1519
 
1439
1520
# connect when "disable_abort_on_error" caused "connection not found"
1440
 
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
1441
1521
--disable_abort_on_error
1442
1522
connect (con1,localhost,root,,);
1443
1523
connection default;
1452
1532
disconnect con2;
1453
1533
connection default;
1454
1534
 
 
1535
# Test enable_connect_log
 
1536
--enable_connect_log
 
1537
connect (con1,localhost,root,,);
 
1538
connection default;
 
1539
connection con1;
 
1540
--disable_query_log
 
1541
# These should not be logged
 
1542
connect (con2,localhost,root,,*NO-ONE*);
 
1543
connection con2;
 
1544
disconnect con2;
 
1545
connection con1;
 
1546
--enable_query_log
 
1547
disconnect con1;
 
1548
connection default;
 
1549
--disable_connect_log
 
1550
 
1455
1551
# ----------------------------------------------------------------------------
1456
1552
# Test mysqltest arguments
1457
1553
# ----------------------------------------------------------------------------
1724
1820
--reap
1725
1821
EOF
1726
1822
--error 1
1727
 
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1
 
1823
# Must filter unpredictable extra warning from output
 
1824
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in > $MYSQL_TMP_DIR/mysqltest.out 2>&1
 
1825
--perl
 
1826
  my $dir= $ENV{'MYSQL_TMP_DIR'};
 
1827
  open (FILE, "$dir/mysqltest.out");
 
1828
  while (<FILE>) {
 
1829
    print unless /Note: net_clear/; # This shows up on rare occations
 
1830
  }
 
1831
EOF
 
1832
remove_file $MYSQL_TMP_DIR/mysqltest.out;
1728
1833
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in;
1729
1834
 
1730
1835
drop table t1;
2407
2512
hello
2408
2513
EOF
2409
2514
 
 
2515
# Verify that --replace_result also work on list_files
 
2516
--replace_result file REPLACED_FILE
2410
2517
list_files $MYSQLTEST_VARDIR/tmp/testdir;
2411
2518
# list_files gets the directory list before creating the new file
2412
2519
list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *;