From: Andreas Schneider Date: Fri, 10 Apr 2026 13:45:08 +0000 (+0200) Subject: s3:tests: Improve debugging for test_wbinfo_lookuprids_cache.sh X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c24438ca972c98db533400d1afebc02fdc29bba6;p=thirdparty%2Fsamba.git s3:tests: Improve debugging for test_wbinfo_lookuprids_cache.sh Note that if this test fails, it is like something else creating keys. The last time it was a crashing smbd which left a key in the database and this test failed as a result. Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner Autobuild-User(master): Günther Deschner Autobuild-Date(master): Wed Apr 22 16:35:58 UTC 2026 on atb-devel-224 --- diff --git a/source3/script/tests/test_wbinfo_lookuprids_cache.sh b/source3/script/tests/test_wbinfo_lookuprids_cache.sh index 31dad5c3f14..7a5d0f7279a 100755 --- a/source3/script/tests/test_wbinfo_lookuprids_cache.sh +++ b/source3/script/tests/test_wbinfo_lookuprids_cache.sh @@ -28,9 +28,29 @@ testit "flush" "$NET" "cache" "flush" || failed=$(expr $failed + 1) testit "lookuprids1" "$WBINFO" "-R" "512,12345" || failed=$(expr $failed + 1) opnum=$($PYTHON -c'from samba.dcerpc.winbind import wbint_LookupRids; print(wbint_LookupRids.opnum())') -key=$("$TDBDUMP" "$cache" | awk -F'"' -v opnum="${opnum}" '/key.*NDR/ { regex = "NDR/[^/]+/" opnum "/.*$"; if (match($2, regex)) print substr($2, RSTART, RLENGTH) }') -testit "delete key" "$TDBTOOL" "$cache" delete "$key" || failed=$((failed + 1)) +ndr_keys=$("$TDBDUMP" "$cache" | awk -F'"' -v opnum="${opnum}" '/key.*NDR/ { regex = "NDR/[^/]+/" opnum "/.*$"; if (match($2, regex)) print substr($2, RSTART, RLENGTH) }') +ndr_key_count=$(echo "$ndr_keys" | grep -c .) +echo "DEBUG: Found ${ndr_key_count} NDR key(s) for opnum ${opnum}:" +echo "$ndr_keys" | while IFS= read -r k; do + echo " key='${k}' (length=${#k})" +done + +key=$(echo "$ndr_keys" | head -1) +echo "DEBUG: Using key='${key}' (length=${#key})" + +if [ -n "$key" ]; then + echo "DEBUG: Verifying key exists with tdbtool show..." + "$TDBTOOL" "$cache" show "$key" 2>&1 \ + && echo "DEBUG: Key found in TDB" \ + || echo "DEBUG: Key NOT found in TDB (show failed)" +fi + +testit "delete key" "$TDBTOOL" "$cache" delete "$key" || { + failed=$((failed + 1)) + echo "DEBUG: Post-failure TDB dump of NDR keys:" + "$TDBDUMP" "$cache" | grep -A1 "key.*NDR" +} testit "lookuprids2" "$WBINFO" "-R" "512,12345" || failed=$(expr $failed + 1) testok $0 $failed