mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: 310 fails with existing directory error
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>
This commit is contained in:
committed by
Rich Johnston
parent
87f5e8e2db
commit
97540f14f7
+17
-18
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user