summaryrefslogtreecommitdiff
path: root/mysql-test/t/drop-no_root.test
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@ibmvm>2009-10-09 18:52:49 +0400
committerAlexander Nozdrin <alik@ibmvm>2009-10-09 18:52:49 +0400
commitbe8e39749674e23433729d6586e92d664abb1328 (patch)
treec9cebcb70721ed2488cb92f159b3692ab3ae214a /mysql-test/t/drop-no_root.test
parentf38006b5329a549cc4e4f5c9bc8f71bac4016ee0 (diff)
downloadmariadb-git-be8e39749674e23433729d6586e92d664abb1328.tar.gz
Backporting of Bug#40128 from 6.0 to next-mr.
Original revision in 6.0: ------------------------------------------------------------ revno: 2599.108.1 committer: Alexander Nozdrin <alik@sun.com> branch nick: 6.0-rpl-bug40128 timestamp: Wed 2009-01-21 15:33:42 +0300 message: Fix for Bug#40128: drop-no_root fails under windows in 6.0-rpl. The problem was that directories with no permission (000) files are deleted differently on UNIX and on Windows. On UNIX, 000-permission file is deleted perfectly, but other files are left in the directory. On Windows, 000-permission file is not deleted, but other files are deleted. Also, the fix needed a change in mysqltest.c: 'chmod' directive should return a positive error code (in order to be handled). It's decided to return a constant '1' for all error codes just to be OS-independent. ------------------------------------------------------------
Diffstat (limited to 'mysql-test/t/drop-no_root.test')
-rw-r--r--mysql-test/t/drop-no_root.test44
1 files changed, 40 insertions, 4 deletions
diff --git a/mysql-test/t/drop-no_root.test b/mysql-test/t/drop-no_root.test
index 05418b9dbb7..8fb5b3f74a8 100644
--- a/mysql-test/t/drop-no_root.test
+++ b/mysql-test/t/drop-no_root.test
@@ -25,17 +25,53 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--echo chmod 000 mysql_test/t1.frm
--chmod 0000 $MYSQLD_DATADIR/mysql_test/t1.frm
+# NOTE: For the DROP DATABASE below we need:
+# - disable result log because ER_DB_DROP_RMDIR contains errno, which can be
+# different on different platforms.
+# - expect different error codes, because Windows and UNIX behaves
+# differently (see below).
+#
+# NOTE: Windows and UNIX behaves differently in this test case:
+#
+# - on UNIX when t1.frm is chmoded to 000, it is perfectly deleted
+# by the first DROP DATABASE, but some other files (t1.MYI and t1.MYD) left
+# in the directory. So, we have to explicitly removes them before the
+# second DROP DATABASE.
+#
+# - on Windows when t1.frm is chmoded to 000, it is not deleted by the first
+# DROP DATABASE, but all other files in the database directory are deleted.
+# Thus, we have to change the t1.frm permissions again and delete it
+# explicitly before the second DROP DATABASE.
+#
+# All those differences do not really matter for the idea of this test case:
+# checking that if DROP DATABASE failed, the client is Ok.
+
--echo
---error ER_DB_DROP_RMDIR
+--disable_result_log
+--error ER_DB_DROP_RMDIR,6
DROP DATABASE mysql_test;
+--enable_result_log
--echo
SELECT DATABASE();
+# Remove t1.MYI and t1.MYD. On UNIX it should succeed. On Windows, it fails.
--echo
---echo rm mysql_test/t1.MYD mysql_test/t1.MYI
---exec rm $MYSQLD_DATADIR/mysql_test/t1.MYD
---exec rm $MYSQLD_DATADIR/mysql_test/t1.MYI
+--echo rm -f mysql_test/t1.MYD mysql_test/t1.MYI
+--error 0, 1
+--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYD
+--error 0, 1
+--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYI
+
+# Make t1.frm removable: fail on UNIX, succeed on Windows.
+--echo chmod 666 mysql_test/t1.frm
+--error 0, 1
+--chmod 0666 $MYSQLD_DATADIR/mysql_test/t1.frm
+
+# Remove t1.frm: fail on UNIX, succeed on Windows.
+--echo rm -f mysql_test/t1.frm
+--error 0, 1
+--remove_file $MYSQLD_DATADIR/mysql_test/t1.frm
--echo
DROP DATABASE mysql_test;