fstests: convert remaining tests to SPDX license tags
[xfstests-dev.git] / tests / generic / 131
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 131
6 #
7 # lock test created from CXFSQA test lockfile_simple
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     kill $locktest_pid2 > /dev/null 2>&1
21     kill $locktest_pid1 > /dev/null 2>&1
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs generic
30 _supported_os Linux
31 _require_test
32 _require_test_fcntl_advisory_locks
33
34 TESTFILE=$TEST_DIR/lock_file
35
36 # Start the server
37 src/locktest $TESTFILE 2>&1 > $TEST_DIR/server.out &
38 locktest_pid1=$!
39
40 sleep 1
41
42 PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}')
43 if [ -z $PORT ]; then
44         echo "Could not get server port"
45         exit 1
46 fi
47
48 # Start the client
49 src/locktest -p $PORT -h localhost $TESTFILE 2>&1 > $TEST_DIR/client.out
50 locktest_pid2=$!
51 result=$?
52 if [ $result -eq 0 ]; then
53         echo success!
54         status=0
55 else
56         echo "Client reported failure ($result)"
57         cat $TEST_DIR/*.out
58 fi
59
60 exit