]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: 310 fails with existing directory error
authorDave Chinner <dchinner@redhat.com>
Wed, 1 May 2013 08:32:00 +0000 (08:32 +0000)
committerRich Johnston <rjohnston@sgi.com>
Fri, 3 May 2013 14:22:12 +0000 (09:22 -0500)
Test 310 fails with:

mkdir: cannot create directory `/mnt/test/tmp': File exists

$TEST_DIR is persistent, so test directories need to be created with
"mkdir -p" so they don't fail if the directory already exists.

Many other things need fixing, too.
- Tests should define directories they use on $TEST_DIR by
  their sequence number, not generic names.

- Use a variable for the directory the test runs in
  ($SEQ_DIR, in this case) to avoid having to manually code
  it everywhere.

- New binaries need to be added to .gitignore.

- Return status for shell functions is 0 for success,
  non-zero for failure.

- Setting status=0 if there is no failure in the first test
  means that even if the second test fails, the test will
  still pass. Change the test to use "_fatal" when a kernel
  bug is detected, and only set status=0 when the entire
  test has finished.

- reduce the default runtime by to roughly a minute and
  scale it with the stress load factor variables. In most
  cases, this test is never going to hit problems (as
  they've already been fixed) so running it for ~4 minutes
  is mostly a waste of time...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
.gitignore
tests/generic/310

index 7a10febee7f2d94cdb57ea6e3c36ff430c881f13..0bd48c3badfc455c2d1cbc97e49a9c2f0faaa509 100644 (file)
@@ -67,6 +67,8 @@
 /src/preallo_rw_pattern_writer
 /src/pwrite_mmap_blocked
 /src/randholes
+/src/t_readdir_1
+/src/t_readdir_2
 /src/rename
 /src/resvtest
 /src/runas
index b5316cd649ee776e14dc5497730f6fb2f7a9e274..26d2d4a7ec892fff0a21c902608572ffc4d89fcb 100755 (executable)
@@ -75,12 +75,11 @@ check_kernel_bug()
        new_warning=`dmesg | grep -c "^WARNING"`
        new_lockdep=`dmesg | grep -c "possible recursive locking detected"`
 
-
        # no kernel bug is detected
        if [ $new_bug -eq $nr_bug -a $new_error -eq $nr_error -a \
             $new_null -eq $nr_null -a $new_warning -eq $nr_warning -a \
             $new_lockdep -eq $nr_lockdep ]; then
-               return 1
+               return 0
        fi
 
        nr_bug=$new_bug
@@ -88,37 +87,36 @@ check_kernel_bug()
        nr_null=$new_null
        nr_warning=$new_warning
        nr_lockdep=$new_lockdep
+       return 1
 }
-mkdir $TEST_DIR/tmp
+
+RUN_TIME=$((30 * $TIME_FACTOR))
+
+SEQ_DIR=$TEST_DIR/$seq
+mkdir -p $SEQ_DIR
 for n in {1..4096}; do
-       touch $TEST_DIR/tmp/$n
+       touch $SEQ_DIR/$n
 done
 
 _test_read()
 {
-       src/t_readdir_1 $TEST_DIR/tmp &
-       sleep 100
+       src/t_readdir_1 $SEQ_DIR &
+       sleep $RUN_TIME
        killall src/t_readdir_1
        check_kernel_bug
-       if [ $? -eq 1 ]; then
-               status=0
-       else
-               echo "error: kernel bug was found, you can see the
-                       dmesg for more infomation."
+       if [ $? -ne 0 ]; then
+               _fatal "kernel bug detected, check dmesg for more infomation."
        fi
 }
 
 _test_lseek()
 {
-       src/t_readdir_2 $TEST_DIR/tmp &
-       sleep 100
+       src/t_readdir_2 $SEQ_DIR &
+       sleep $RUN_TIME
        killall src/t_readdir_2
        check_kernel_bug
-       if [ $? -eq 1 ]; then
-               status=0
-       else
-               echo "error: kernel bug was found, you can see the
-                       dmesg for more infomation."
+       if [ $? -ne 0 ]; then
+               _fatal "kernel bug detected, check dmesg for more infomation."
        fi
 }
 
@@ -127,4 +125,5 @@ _test_lseek
 
 # success, all done
 echo "*** done"
+status=0
 exit