2 # Copyright (c) 2021 Proofpoint, Inc. and its suppliers.
5 # By using this file, you agree to the terms and conditions set
6 # forth in the LICENSE file which can be found at the top level of
7 # the sendmail distribution.
9 # ----------------------------------------
10 # test t-lockfile, analyze result
11 # ----------------------------------------
24 # the "owner" unlock operation must be before
25 # the "client" lock operation can succeed
26 U=`grep -n 'owner=1, unlock.*done' $O | cut -d: -f1 | head -n1`
27 [ x"$U" = "x" ] && U=`grep -n '_close' $O | cut -d: -f1 | head -n1`
28 L=`grep -n 'owner=0, lock.* ok' $O | cut -d: -f1`
29 [ x"$U" = "x" ] && return 1
30 [ x"$L" = "x" ] && return 1
35 while getopts 2a: FLAG
40 analyze || fail "$opts: unlock1=$U, lock2=$L"
44 shift `expr ${OPTIND} - 1`
46 [ -x ${PRG} ] || fail "missing ${PRG}"
50 for opts in "" "-r" "-n" "-nr"
52 ${PRG} $opts > $O 2>&1 || fail "$opts: $?"
53 analyze || fail "$opts: unlock1=$U, lock2=$L"
57 # try with two processes
61 ${PRG} -W >> $O 2>&1 || fail "-W: $?"
63 ${PRG} -R $opts >> $O 2>&1 || fail "-R $opts: $?"
65 analyze || fail "$opts: unlock1=$U, lock2=$L"