From: Martin Schwenke Date: Fri, 12 Feb 2021 08:08:37 +0000 (+1100) Subject: ctdb-scripts: Update debug_locks.sh to handle arguments X-Git-Tag: tevent-0.11.0~705 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e62ae53ef6d04016e3a3453380c9add3ce888e3c;p=thirdparty%2Fsamba.git ctdb-scripts: Update debug_locks.sh to handle arguments Don't use the arguments yet. They will be used in a simplified version of the code. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/debug_locks.sh b/ctdb/config/debug_locks.sh index d83f3bb368e..892889e86be 100755 --- a/ctdb/config/debug_locks.sh +++ b/ctdb/config/debug_locks.sh @@ -12,6 +12,17 @@ . "${CTDB_BASE}/functions" +if [ $# -ne 4 ] ; then + die "usage: $0 { DB | RECORD } { FCNTL | MUTEX }" +fi + +lock_helper_pid="$1" +# lock_scope is unused for now +# shellcheck disable=SC2034 +lock_scope="$2" +tdb_path="$3" +lock_type="$4" + # type is at least mentioned in POSIX and more is portable than which(1) # shellcheck disable=SC2039 if ! type gstack >/dev/null 2>&1 ; then diff --git a/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh b/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh index 1a3b83c1757..d9c3df76d57 100644 --- a/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh +++ b/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh @@ -53,11 +53,13 @@ do_test () _holder_state="$2" _helper_scope="$3" + _lock_helper_pid="4132032" + FAKE_PS_MAP=$(cat < POSIX ADVISORY WRITE 4132032 ${_locking_tdb_id} 168 170 +-> POSIX ADVISORY WRITE ${_lock_helper_pid} ${_locking_tdb_id} 168 170 EOF ) elif [ "$_helper_scope" = "RECORD" ] ; then _helper_lock=$(cat < POSIX ADVISORY WRITE 4132032 ${_locking_tdb_id} 112736 112736 +-> POSIX ADVISORY WRITE ${_lock_helper_pid} ${_locking_tdb_id} 112736 112736 EOF ) fi @@ -206,5 +208,10 @@ $_out ===== End of debug locks PID=PID ===== EOF - script_test "${script_dir}/${script}" + script_test "${script_dir}/${script}" \ + "$_lock_helper_pid" \ + "$_helper_scope" \ + "$_path" \ + "fcntl" + }