diff options
Diffstat (limited to 'ctdb/tests/UNIT')
-rw-r--r-- | ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh | 21 | ||||
-rwxr-xr-x | ctdb/tests/UNIT/eventscripts/stubs/stat | 18 |
2 files changed, 29 insertions, 10 deletions
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh b/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh index d9c3df76d57..162dc21b2ac 100644 --- a/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh +++ b/ctdb/tests/UNIT/eventscripts/scripts/debug_locks.sh @@ -168,25 +168,26 @@ EOF ' _db="locking.tdb.${FAKE_CTDB_PNN}" - _pids='' + if [ -n "$_helper_lock" ] ; then + read -r _ _ _ _ _pid _ _start _end <<EOF +$_helper_lock +EOF + _out="Waiter:${_nl}" + _out="${_out}${_pid} ctdb_lock_helpe ${_db} ${_start} ${_end}" + fi + # fake lock info + _pids='' + _out="${_out:+${_out}${_nl}}Lock holders:" while read -r _ _ _ _pid _ _start _end ; do _comm="smbd" - _out="${_out:+${_out}${_nl}}" + _out="${_out}${_nl}" _out="${_out}${_pid} smbd ${_db} ${_start} ${_end}" _pids="${_pids:+${_pids} }${_pid}" done <<EOF $_holder_lock EOF - if [ -n "$_helper_lock" ] ; then - read -r _ _ _ _ _pid _ _start _end <<EOF -$_helper_lock -EOF - _out="${_out}${_nl}" - _out="${_out}${_pid} ctdb_lock_helpe ${_db} ${_start} ${_end} W" - fi - # fake stack traces for _pid in $_pids ; do _comm="smbd" diff --git a/ctdb/tests/UNIT/eventscripts/stubs/stat b/ctdb/tests/UNIT/eventscripts/stubs/stat index 04c654883d2..71508f6795d 100755 --- a/ctdb/tests/UNIT/eventscripts/stubs/stat +++ b/ctdb/tests/UNIT/eventscripts/stubs/stat @@ -16,6 +16,19 @@ while getopts "c:h:?" opt ; do done shift $((OPTIND - 1)) +fake_device_id () +{ + _path="$1" + + _t=$(echo "$FAKE_FILE_ID_MAP" | + awk -v path="${_path}" '$1 == path { print $2 }') + _major_minor="${_t%:*}" + _major="0x${_major_minor%:*}" + _minor="0x${_major_minor#*:}" + _device_id=$((_major * 256 + _minor)) + echo "$_device_id" +} + fake_inode () { _path="$1" @@ -40,6 +53,11 @@ if [ -n "$format" ] ; then inode=$(fake_inode "$path") echo "s#[0-9a-f]*:[0-9a-f]*:${inode} #${f} #" ;; + "%d:%i") + device_id=$(fake_device_id "$path") + inode=$(fake_inode "$path") + echo "${device_id}:${inode}" + ;; *) echo "Unsupported format \"${format}\"" usage |