1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/ctdb/tests/cunit/cluster_mutex_003.sh
Martin Schwenke fae8e438f0 ctdb-mutex: Change parent checking to use an asynchronous computation
Put the checking for the process being immediately re-parented into
the computation too.  This will be very rare and doing it
consistently makes testing saner.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-26 03:34:17 +00:00

69 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# This tests a helper, externally configured via !
# By default this is the fcntl helper, so this is a subset of test 002.
# However, other helps can be tested by setting CTDB_TEST_MUTEX_HELPER.
. "${TEST_SCRIPTS_DIR}/unit.sh"
export CTDB_CLUSTER_MUTEX_HELPER="/bin/false"
lockfile="${TEST_VAR_DIR}/cluster_mutex.lockfile"
trap 'rm ${lockfile}' 0
if [ -n "$CTDB_TEST_MUTEX_HELPER" ] ; then
helper="$CTDB_TEST_MUTEX_HELPER"
else
t="${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb_mutex_fcntl_helper"
helper="!${t} ${lockfile}"
fi
ok <<EOF
LOCK
UNLOCK
EOF
unit_test cluster_mutex_test lock-unlock "$helper"
ok <<EOF
LOCK
CONTENTION
NOLOCK
UNLOCK
EOF
unit_test cluster_mutex_test lock-lock-unlock "$helper"
ok <<EOF
LOCK
UNLOCK
LOCK
UNLOCK
EOF
unit_test cluster_mutex_test lock-unlock-lock-unlock "$helper"
ok <<EOF
CANCEL
NOLOCK
EOF
unit_test cluster_mutex_test lock-cancel-check "$helper"
ok <<EOF
CANCEL
UNLOCK
EOF
unit_test cluster_mutex_test lock-cancel-unlock "$helper"
ok <<EOF
LOCK
UNLOCK
EOF
unit_test cluster_mutex_test lock-wait-unlock "$helper"
ok <<EOF
LOCK
parent gone
LOCK
UNLOCK
EOF
unit_test cluster_mutex_test lock-ppid-gone-lock-unlock "$helper"