]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstest 245: accept ENOTEMPTY as a valid error
authorJosef Bacik <josef@redhat.com>
Tue, 30 Nov 2010 22:22:34 +0000 (23:22 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 30 Nov 2010 22:22:34 +0000 (23:22 +0100)
Test 245 only checks to see if the rename returned EEXIST, but according to the
rename(2) manpage, ENOTEMPTY is also a valid result, which is in fact what Btrfs
returns.  So just filter the output for ENOTEMPTY so that either EEXIST or
ENOTEMPTY will pass the test.  It's not pretty I know, but I couldn't really
figure out a good way to get an either/or output to compare.  With this fix
Btrfs now passes 245.

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
245 [changed mode: 0644->0755]

diff --git a/245 b/245
old mode 100644 (file)
new mode 100755 (executable)
index 9c1cd3a..02b3173
--- a/245
+++ b/245
@@ -48,6 +48,14 @@ _cleanup()
        rm -rf $dir
 }
 
+# According to the rename(2) manpage you can get either EEXIST or ENOTEMPTY as an
+# error for trying to rename a non-empty directory, so just catch the error for
+# ENOTMEMPTY and replace it with the EEXIST output so that either result passes
+_filter_directory_not_empty()
+{
+       sed -e "s,Directory not empty,File exists,g"
+}
 trap "_cleanup ; exit \$status" 0 1 2 3 15
 
 
@@ -59,7 +67,7 @@ touch $dir/aa/1
 mkdir $dir/ab/aa
 touch $dir/ab/aa/2
 
-mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir
+mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir | _filter_directory_not_empty
 
 status=0
 exit $status