mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
generic/426: factor out helper functions
Helper test_file_handles() outputs the sub-test command to output, so if errors are detected in one of the sub-tests, it is easier to know which sub-tests have failed. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
48a67c3543
commit
d732a15548
+29
-11
@@ -52,25 +52,43 @@ _require_test
|
||||
_require_test_program "open_by_handle"
|
||||
_require_exportfs
|
||||
|
||||
numfiles=1024
|
||||
NUMFILES=1024
|
||||
testdir=$TEST_DIR/$seq-dir
|
||||
mkdir -p $testdir
|
||||
|
||||
# Create empty test files in test dir
|
||||
create_test_files()
|
||||
{
|
||||
local dir=$1
|
||||
local opt=$2
|
||||
|
||||
mkdir -p $dir
|
||||
rm -f $dir/*
|
||||
src/open_by_handle -c $dir $NUMFILES
|
||||
}
|
||||
|
||||
# Test encode/decode file handles
|
||||
test_file_handles()
|
||||
{
|
||||
local dir=$1
|
||||
local opt=$2
|
||||
|
||||
echo test_file_handles $* | _filter_test_dir
|
||||
src/open_by_handle $opt $dir $NUMFILES
|
||||
}
|
||||
|
||||
# Check stale handles to deleted files
|
||||
rm -f $testdir/*
|
||||
src/open_by_handle -c $testdir $numfiles
|
||||
src/open_by_handle -d $testdir $numfiles
|
||||
create_test_files $testdir
|
||||
test_file_handles $testdir -d
|
||||
|
||||
# Check non-stale handles to linked files
|
||||
rm -f $testdir/*
|
||||
src/open_by_handle -c $testdir $numfiles
|
||||
src/open_by_handle $testdir $numfiles
|
||||
create_test_files $testdir
|
||||
test_file_handles $testdir
|
||||
|
||||
# Check non-stale handles to files that were hardlinked and original deleted
|
||||
rm -f $testdir/*
|
||||
src/open_by_handle -c $testdir $numfiles
|
||||
src/open_by_handle -l $testdir $numfiles
|
||||
src/open_by_handle -u $testdir $numfiles
|
||||
create_test_files $testdir
|
||||
test_file_handles $testdir -l
|
||||
test_file_handles $testdir -u
|
||||
|
||||
echo "Silence is golden"
|
||||
status=0
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
QA output created by 426
|
||||
test_file_handles TEST_DIR/426-dir -d
|
||||
test_file_handles TEST_DIR/426-dir
|
||||
test_file_handles TEST_DIR/426-dir -l
|
||||
test_file_handles TEST_DIR/426-dir -u
|
||||
Silence is golden
|
||||
|
||||
Reference in New Issue
Block a user