test: verify the mapped CLR inode in late-slope diagnostics

This commit is contained in:
Joseph Doherty
2026-11-10 18:02:08 -05:00
parent 8b9326ea06
commit 9fb8d12d34
2 changed files with 30 additions and 2 deletions
@@ -1,5 +1,18 @@
#!/usr/bin/env bash
# Execute the immutable self-contained apphost through the cached Linux VSTest controller.
verify_mapped_coreclr() {
awk -v identity="$2" '
$6 ~ /\/libcoreclr.so$/ {
if (NF != 6 || ($5 " " $6) != identity) bad = 1
else matched = 1
}
END { exit (matched && !bad) ? 0 : 1 }
' "$1"
}
# The offline controls source only the mapping check above.
if [[ ${BASH_SOURCE[0]} != "$0" ]]; then return 0; fi
set -euo pipefail
umask 077
app=ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests
@@ -51,8 +64,8 @@ while ((SECONDS < proof_deadline)) && kill -0 "$vstest_pid" 2>/dev/null; do
[[ $pid =~ ^[1-9][0-9]*$ ]]
executable=$(readlink "/proc/$pid/exe")
[[ $executable == "/app/$app" ]]
runtime=$(awk '$6 ~ /\/libcoreclr.so$/ {print $6}' "/proc/$pid/maps" | sort -u)
[[ $runtime == /app/libcoreclr.so ]]
runtime=/app/libcoreclr.so
verify_mapped_coreclr "/proc/$pid/maps" "$(stat -c '%i %n' "$runtime")"
runtime_hash=$(sha256sum "$runtime")
printf 'targetPid=%s\nactualExecutable=%s\nmappedCoreClr=%s\ncoreClrSha256=%s\n' \
"$pid" "$executable" "$runtime" "${runtime_hash%% *}" > /task/target-runtime.txt