summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMatthias Leich <matthias.leich@oracle.com>2011-01-07 13:08:05 +0100
committerMatthias Leich <matthias.leich@oracle.com>2011-01-07 13:08:05 +0100
commit530a83a16d83aede26c9edb47163363070145e99 (patch)
treeb8c7620342d19cf03beaccfe19fd504761454043 /mysql-test
parentda9cb6e1e25e6f2fb938a864411c3f10a8493e7d (diff)
downloadmariadb-git-530a83a16d83aede26c9edb47163363070145e99.tar.gz
1. Fix for Bug#58600 main.not_embedded_server test does not cleanup properly
- remove the superfluous file - add an preemptive removal of the outfile before the SELECT ... INTO OUTFILE ... 2. Remove an already disabled subtest It's functionality is covered by tests in the suite funcs_1. 3. Adjust the formatting within some sub testcase to the formatting used in all other sub testcases
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/not_embedded_server.result14
-rw-r--r--mysql-test/t/not_embedded_server.test50
2 files changed, 25 insertions, 39 deletions
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index ce229bf3e2e..1f8fdb65407 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -7,13 +7,13 @@ slave_skip_errors OFF
#
# FLUSH PRIVILEGES should not implicitly unlock locked tables.
#
-drop table if exists t1;
-create table t1 (c1 int);
-lock tables t1 read;
-flush privileges;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT);
+LOCK TABLES t1 READ;
+FLUSH PRIVILEGES;
ERROR HY000: Table 'host' was not locked with LOCK TABLES
-unlock tables;
-drop table t1;
+UNLOCK TABLES;
+DROP TABLE t1;
#
# Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
#
@@ -28,7 +28,7 @@ CREATE FUNCTION f() RETURNS INT RETURN 1;
GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
FLUSH PRIVILEGES;
connection: con1
-SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
+SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '<outfile>';
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test
index 3fea1f630e0..c1dbba82292 100644
--- a/mysql-test/t/not_embedded_server.test
+++ b/mysql-test/t/not_embedded_server.test
@@ -4,31 +4,7 @@
-- source include/not_embedded.inc
-# The following fails sporadically because 'check-testcase' runs
-# queries before this test and there is no way to guarantee that any
-# previous process finishes. The purpose of the test is not clearly
-# stated, there is no reference to any bug report, and "select from
-# I_S from prepared statement" doesn't look like something that's
-# really imporant to test. I'm commenting out this for now. If
-# anyone wants to keep this, please fix the race and motivate why we
-# need to test this. If you see this comment and it is after mid-2009
-# or so, feel free to remove this test from the file. /Sven
-#
-#
-## Show full process list with prepare
-## To not show other connections, this must be the first test and we must
-## have a server restart before this one
-##
-## We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to
-## exclude system threads that may/may not be active in the server
-## (namely the ndb injector thread)
-##
-## End of 4.1 tests
-#
-#prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
-#--replace_column 1 number 6 time 3 localhost
-#execute stmt1;
-#deallocate prepare stmt1;
+# End of 4.1 tests
call mtr.add_suppression("Can't open and lock privilege tables: Table 'host' was not locked with LOCK TABLES");
@@ -46,14 +22,14 @@ SHOW VARIABLES like 'slave_skip_errors';
--echo # FLUSH PRIVILEGES should not implicitly unlock locked tables.
--echo #
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1 (c1 int);
-lock tables t1 read;
+CREATE TABLE t1 (c1 INT);
+LOCK TABLES t1 READ;
--error ER_TABLE_NOT_LOCKED
-flush privileges;
-unlock tables;
-drop table t1;
+FLUSH PRIVILEGES;
+UNLOCK TABLES;
+DROP TABLE t1;
--echo #
--echo # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
@@ -83,8 +59,18 @@ connect (con1,localhost,nopriv_user,,);
connection con1;
--echo connection: con1
+let outfile=$MYSQLTEST_VARDIR/tmp/mytest;
+--error 0,1
+--remove_file $outfile
+--replace_result $outfile <outfile>
--error ER_PROCACCESS_DENIED_ERROR
-SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
+eval SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '$outfile';
+# A removal of the outfile is necessary, at least today (2010-12-07), because
+# the outfile is created even if the SELECT statement fails.
+# If the server is improved in the future this may not happen.
+# ==> Do not fail if the outfile does not exist.
+--error 0,1
+--remove_file $outfile
--error ER_PROCACCESS_DENIED_ERROR
INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;