Bug #40720 partition_alter3_innodb fails on windows due to use of 'rm' command
Submitted: 13 Nov 2008 22:21 Modified: 13 Nov 2008 22:47
Reporter: Mattias Jonsson Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: CPU Architecture:Any

[13 Nov 2008 22:21] Mattias Jonsson
Description:
When running the parts suite on windows, parts.partition_alter3_innodb fails, due to missing 'rm' command.

parts.partition_alter3_innodb  [ fail ]

'rm' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.
mysqltest: In included file ".\suite\parts\inc\partition_check_drop.inc": At lin
e 62: command "rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true" failed

The result from queries just before the failure was:
< snip >
  `f_date` date DEFAULT NULL,
  `f_varchar` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
t1.frm
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id      select_type     table   partitions      type    possible_keys   key
key_len ref     rows    Extra
1       SIMPLE  t1      NULL    ALL     NULL    NULL    NULL    NULL    20
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
#  1.2.7 Remove partitioning from not partitioned table --> ????
ALTER TABLE t1 REMOVE PARTITIONING;
DROP TABLE t1;
# Attention: There are unused files.
#            Either the DROP TABLE or a preceding ALTER TABLE
#            <alter partitioning> worked incomplete.
# We found:
unified filelist
--- not determined ---
exec of 'rm -f E:/mysql_from_pb2/bugteam/mysql-5.1.31-patched/mysql-test/var/mas
ter-data/test/t1* || true' failed, error: 1, status: 1, errno: 2

More results from queries before failure can be found in E:\mysql_from_pb2\bugte
am\mysql-5.1.31-patched\mysql-test\var\log\partition_alter3_innodb.log

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

How to repeat:
run parts.partition_alter3_innodb on windows (where the 'rm' command is not installed).

Suggested fix:
Restructure mysql-test/suite/parts/inc/partition_check_drop.inc (see below, remove the 'if ($ls)' for printing out garbage files and make it depend on '$do_file_tests' instead. This should cause the test to fail if any non approved garbage file is left, and then one can rely on the test framework to clean up.

=== modified file 'mysql-test/suite/parts/inc/partition_check_drop.inc'
--- mysql-test/suite/parts/inc/partition_check_drop.inc	2008-07-09 11:19:04 +0000
+++ mysql-test/suite/parts/inc/partition_check_drop.inc	2008-11-13 22:01:48 +0000
@@ -29,11 +29,6 @@
 --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
 }
 eval SET @aux = load_file('$ls_file');
-}
-if (!$do_file_tests)
-{
-SET @aux = '--- not determined ---';
-}
 
 # UPDATE the current filelist of the table t1 within t0_definition
 # Note: This list should be empty, because the table t1 was dropped !
@@ -46,23 +41,21 @@
 if ($found_garbage)
 {
    # Unfortunately the DROP TABLE did not remove the unused files
-   if ($ls)
-   {
-      --echo # Attention: There are unused files.
-      --echo #            Either the DROP TABLE or a preceding ALTER TABLE
-      --echo #            <alter partitioning> worked incomplete.
-      --echo # We found:
-      # Print the list of files into the protocol
-      eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
-                  AS "unified filelist"
-           FROM t0_definition WHERE state = 'old';
-   }
-   # Do a manual cleanup, because the following tests should not suffer from
-   # remaining files
-   --exec rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true
-   if ($with_directories)
-   {
-	   --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
-   }
+   --echo # Attention: There are unused files.
+   --echo #            Either the DROP TABLE or a preceding ALTER TABLE
+   --echo #            <alter partitioning> worked incomplete.
+   --echo # We found:
+   # Print the list of files into the protocol
+   eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
+               AS "unified filelist"
+        FROM t0_definition WHERE state = 'old';
+   # No manual cleanup, because the framework should clean up since we fail.
+}
+}
+if (!$do_file_tests)
+{
+INSERT INTO t0_definition
+     SET state = 'old', file_list = '--- not determined ---'
+ON DUPLICATE KEY UPDATE file_list = '--- not determined ---';
 }
 --enable_query_log

=== modified file 'mysql-test/suite/parts/r/partition_alter3_innodb.result'
--- mysql-test/suite/parts/r/partition_alter3_innodb.result	2008-11-04 07:43:21 +0000
+++ mysql-test/suite/parts/r/partition_alter3_innodb.result	2008-11-13 21:56:37 +0000
@@ -368,12 +368,6 @@
 #  1.2.7 Remove partitioning from not partitioned table --> ????
 ALTER TABLE t1 REMOVE PARTITIONING;
 DROP TABLE t1;
-# Attention: There are unused files.
-#            Either the DROP TABLE or a preceding ALTER TABLE
-#            <alter partitioning> worked incomplete.
-# We found:
-unified filelist
---- not determined ---
 
 #========================================================================
 #  2.    Partition management commands on KEY partitioned table
@@ -701,12 +695,6 @@
 #  2.2.7 Remove partitioning from not partitioned table --> ????
 ALTER TABLE t1 REMOVE PARTITIONING;
 DROP TABLE t1;
-# Attention: There are unused files.
-#            Either the DROP TABLE or a preceding ALTER TABLE
-#            <alter partitioning> worked incomplete.
-# We found:
-unified filelist
---- not determined ---
 DROP VIEW  IF EXISTS v1;
 DROP TABLE IF EXISTS t1;
 DROP TABLE IF EXISTS t0_aux;
[13 Nov 2008 22:47] MySQL Verification Team
Thank you for the bug report. Duplicate of bug: http://bugs.mysql.com/bug.php?id=39465