diff --git a/scripts/windows/native-test b/scripts/windows/native-test index 8fadf1a..0c41c3c 100755 --- a/scripts/windows/native-test +++ b/scripts/windows/native-test @@ -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 diff --git a/test/windowsnative/native_fixture_test.go b/test/windowsnative/native_fixture_test.go index 6772b2b..14e7329 100644 --- a/test/windowsnative/native_fixture_test.go +++ b/test/windowsnative/native_fixture_test.go @@ -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",