summaryrefslogtreecommitdiffstats
path: root/lock/runtests
blob: 21b09a5d0ed7e276f37fecd667b945d47079542e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
:
#!/bin/sh
#
#       @(#)runtests	1.4 99/07/16 Connectathon testsuite
#

InitFile="../tests.init"

# Save mount options because InitFile clobbers it (XXX).
mntopts="$MNTOPTIONS"

. $InitFile

if test $# -ge 1
then
	TESTARG=$1
fi

set -e
umask 0

echo "Starting LOCKING tests: test directory $NFSTESTDIR (arg: $TESTARG)"

if test ! -d $NFSTESTDIR
then
	mkdir $NFSTESTDIR
fi
if test ! -d $NFSTESTDIR
then
	echo "Can't make directory $NFSTESTDIR"
	exit 1
fi

case $TESTARG in
	-f)	TESTARGS=""	;;
	-t)	TESTARGS="-r"	;;
esac

if [ "$CIFS" != "yes" ] && echo "$mntopts" | grep vers=2 > /dev/null
then
	TESTARGS="-v 2 $TESTARGS"
fi

if [ "$CIFS" = "yes" ]; then
	TESTARGS="-c $TESTARGS"
fi

for i in $LOCKTESTS
do
	echo ""
	case $i in
		tlock)		echo 'Testing native pre-LFS locking';;
		tlocklfs)	echo 'Testing native post-LFS locking';;
		tlock64)
			if [ "$CIFS" != "yes" ] &&
			   echo "$mntopts" | grep vers=2 > /dev/null
			then
			echo "64-bit locking not supported with NFS v2"
				echo " "
				continue
			else
				echo 'Testing non-native 64 bit LFS locking'
			fi
			;;
	esac
	echo ""
	$i $TESTARGS $NFSTESTDIR
done

echo "Congratulations, you passed the locking tests!"

exit 0