Imported Upstream version 1.5.1
This commit is contained in:
34
tests/test_scripts/test_flocks.sh
Executable file
34
tests/test_scripts/test_flocks.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
touch testfile
|
||||
|
||||
(
|
||||
flock -n -x 10
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "could not acquire log!"
|
||||
exit 1
|
||||
fi
|
||||
sleep 10
|
||||
flock -u 10
|
||||
) 10>testfile &
|
||||
|
||||
sleep 1
|
||||
|
||||
(
|
||||
flock -n -x 11
|
||||
if [ $? -ne 1 ]
|
||||
then
|
||||
echo "could acquire lock!"
|
||||
exit 1
|
||||
fi
|
||||
) 11>testfile
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "locking works :)"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user