File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ cleanup()
1818 rmdir $dir
1919}
2020
21-
2221# $1 - disk image
2322# $2 - fstype
2423function prepfs()
@@ -33,9 +32,10 @@ function prepfs()
3332# $1 - disk image
3433# $2 - mount point
3534# $3 - filesystem type
35+ # $4 - lock file
3636lklfuse_mount ()
3737{
38- ${script_dir} /../lklfuse $1 $2 -o type=$3
38+ ${script_dir} /../lklfuse $1 $2 -o type=$3 ,lock= $4
3939}
4040
4141# $1 - mount point
@@ -74,6 +74,21 @@ lklfuse_stressng()
7474 --sync-file-bytes 10m
7575}
7676
77+ # $1 - disk image
78+ # $2 - filesystem type
79+ # $3 - lock file
80+ lklfuse_lock_conflict ()
81+ {
82+ local ret=$TEST_FAILURE unused_mnt=` mktemp -d`
83+
84+ set +e
85+ # assume lklfuse already running with same lock file, causing lock conflict
86+ ${script_dir} /../lklfuse -f $1 $unused_mnt -o type=$2 ,lock=$3
87+ [ $? -eq 2 ] && ret=$TEST_SUCCESS
88+ rmdir " $unused_mnt "
89+ return $ret
90+ }
91+
7792if [ " $1 " = " -t" ]; then
7893 shift
7994 fstype=$1
@@ -102,18 +117,19 @@ if [ -z $(which mkfs.$fstype) ]; then
102117 exit 0
103118fi
104119
105-
106120file=` mktemp`
107121dir=` mktemp -d`
122+ lock_file=" $file "
108123
109124trap cleanup EXIT
110125
111- lkl_test_plan 4 " lklfuse $fstype "
126+ lkl_test_plan 5 " lklfuse $fstype "
112127
113128lkl_test_run 1 prepfs $file $fstype
114- lkl_test_run 2 lklfuse_mount $file $dir $fstype
129+ lkl_test_run 2 lklfuse_mount $file $dir $fstype $lock_file
115130lkl_test_run 3 lklfuse_basic $dir
116131# stress-ng returns 2 with no apparent failures so skip it for now
117132# lkl_test_run 4 lklfuse_stressng $dir $fstype
133+ lkl_test_run 4 lklfuse_lock_conflict $file $fstype $lock_file
118134trap : EXIT
119- lkl_test_run 4 cleanup
135+ lkl_test_run 5 cleanup
You can’t perform that action at this time.
0 commit comments