test: cover native stdin close over wss

This commit is contained in:
2026-09-11 06:45:53 +00:00
parent 766129c69e
commit d753e8b698
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -157,6 +157,28 @@ assert_context() {
fail "$label did not reach terminal success"
}
assert_stdin_close() {
issued=$(rvc run --background --shell cmd "$client_id" 'set /p RVBOX_STDIN= & echo RVBOX_STDIN_%RVBOX_STDIN%' 2>&1) || fail "stdin command admission failed: $issued"
issue=$(printf '%s\n' "$issued" | awk 'NR == 1 { print $1 }')
case $issue in ????????-????-7???-????-????????????) ;; *) fail "stdin command returned invalid issue UUID: $issued" ;; esac
# The command remains running until the durable StdinWrite reaches the
# native service. Use the public rvc controls, not guest-side injection.
rvc append "$client_id" "$issue" RVBOX_NATIVE_INPUT >/dev/null || fail "stdin append failed"
rvc close-stdin "$client_id" "$issue" >/dev/null || fail "stdin close failed"
attempt=0
while [ "$attempt" -lt 45 ]; do
result=$(rvc stat "$client_id" "$issue" 2>/dev/null || true)
if printf '%s\n' "$result" | grep -q 'lifecycle=COMMAND_SUCCEEDED'; then
printf '%s\n' "$result" >"$fixture_dir/stdin-close.stat"
printf 'passed stdin-close issue=%s\n' "$issue"
return 0
fi
case $result in *'lifecycle=COMMAND_FAILED'*|*'lifecycle=COMMAND_REJECTED'*|*'lifecycle=COMMAND_TERMINATED'*) fail "stdin command did not succeed: $result" ;; esac
attempt=$((attempt + 1)); sleep 1
done
fail "stdin command did not reach terminal success"
}
collect() {
if [ "$vm_prepared" = yes ]; then
"$repo_root/scripts/windows/test-host" collect --run-id "$run_id" || true
@@ -201,6 +223,7 @@ case $action in
"$repo_root/scripts/windows/test-host" install --run-id "$run_id"
"$repo_root/scripts/windows/test-host" run --run-id "$run_id" --endpoint "$endpoint_host:$port"
wait_client
assert_stdin_close
assert_context active-user no active-user
assert_context active-user-elevated yes active-user-elevated
"$repo_root/scripts/windows/test-host" run --run-id "$run_id" --fail-contexts ACTIVE_USER_ELEVATED
@@ -28,6 +28,9 @@ func TestNativeFixtureAssets_HP_HARNESS_20(t *testing.T) {
"scripts/windows/test-host\" prepare",
"ACTIVE_USER_ELEVATED,ACTIVE_SYSTEM",
"assert_context local-service no local-service",
"assert_stdin_close",
"rvc append \"$client_id\" \"$issue\" RVBOX_NATIVE_INPUT",
"rvc close-stdin \"$client_id\" \"$issue\"",
"clean --purge --yes",
"RVBOX_NATIVE_ENDPOINT_HOST",
"test/linux-server/compose.yaml",