From e62ae53ef6d04016e3a3453380c9add3ce888e3c Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 12 Feb 2021 19:08:37 +1100 Subject: [PATCH] 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 --- ctdb/config/debug_locks.sh | 11 +++++++++++ .../UNIT/eventscripts/scripts/debug_locks.sh | 15 +++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) 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" + } -- 2.47.3