]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Update debug_locks.sh to handle arguments
authorMartin Schwenke <martin@meltin.net>
Fri, 12 Feb 2021 08:08:37 +0000 (19:08 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 28 May 2021 06:46:29 +0000 (06:46 +0000)
Don't use the  arguments yet.  They will be used in a simplified
version of the code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/debug_locks.sh
ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh

index d83f3bb368e968ead08c6ba1b0e6f247f13e75cd..892889e86beab6e296f012014589cc135b7d7ee5 100755 (executable)
 
 . "${CTDB_BASE}/functions"
 
+if [ $# -ne 4 ] ; then
+       die "usage: $0 <pid> { DB | RECORD } <tdb_path> { 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
index 1a3b83c175774c2072b3e450f29bddd5108fcad5..d9c3df76d573ec935d5089fad1e0c9ddabe2d07e 100644 (file)
@@ -53,11 +53,13 @@ do_test ()
        _holder_state="$2"
        _helper_scope="$3"
 
+       _lock_helper_pid="4132032"
+
        FAKE_PS_MAP=$(cat <<EOF
 1234567 ctdbd S
 2345678 smbd S
 4131931 smbd ${_holder_state}
-4132032 ctdb_lock_helpe S+
+${_lock_helper_pid} ctdb_lock_helpe S+
 EOF
                   )
        export FAKE_PS_MAP
@@ -117,12 +119,12 @@ EOF
        _helper_lock=""
        if [ "$_helper_scope" = "DB" ] ; then
                _helper_lock=$(cat <<EOF
--> 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 <<EOF
--> 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"
+
 }