test: verify the mapped CLR inode in late-slope diagnostics
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user