Skip to content

x86: a registry test's user process trips the userspace runner's terminal verdict early #681

Description

@ryanbreen

What happens

tty_foreground_pgrp (Process subsystem, Arch::Any, EarlyBoot) calls create_user_process to check that creation sets the TTY foreground pgrp. On x86 with the #533 staged-registry dispatch enabled, that process runs and exits during EarlyBoot, long before the boot's real userspace suite has been created. sys_exit sees no remaining userspace threads and publishes the run's terminal verdict:

[ INFO] kernel::syscall::handlers: USERSPACE: sys_exit called with code: 0
[ INFO] kernel::syscall::handlers: No more userspace threads remaining
[ INFO] kernel::syscall::handlers: 🎯 USERSPACE TEST COMPLETE - All processes finished successfully
[ INFO] kernel::syscall::handlers: TEST_TALLY: exited=1 nonzero=0 failed=[]
[ INFO] kernel::syscall::handlers: 🏁 TEST RUNNER: All tests passed - you can exit QEMU now 🏁
[ INFO] kernel::process::creation: create_user_process: User thread 1215 enqueued for scheduling
[ INFO] kernel::test_framework::registry: [TTY_PGRP_TEST] Process created with PID 103

Note the ordering: the terminal verdict is printed before create_user_process has even finished logging its own success.

docker/qemu/run-x86-boot-tests.sh breaks its poll loop on TEST RUNNER: (All tests passed|FAILED) and scores the run against EXPECTED_USERSPACE_EXITS=104 and the TEST_TALLY: line. A one-process tally satisfying the terminal-marker wait is a false green shape: the gate can stop waiting while the suite it is meant to score has not started.

Why it is not visible on main

The x86 staged registry has never been dispatched (#533), so tty_foreground_pgrp has never run on x86. On aarch64 the test runs but that arch has no equivalent "no more userspace threads ⇒ publish the run verdict" hook on this path.

Reproduction

cargo build --release --features boot_tests,testing,external_test_bins,x86_staged_registry --bin qemu-uefi
./docker/qemu/run-x86-boot-tests.sh 1

Preserved evidence

docs/planning/green-program/tracing/serials/x86-r4-strand-excerpt.txt.

Shape of a fix

The "no more userspace threads" completion hook needs to distinguish the boot's registered userspace suite from a process a kernel test created for its own purposes — either by not counting boot-test-created processes toward the suite, or by not arming the completion check until the suite has been registered.

Blocks

#533, together with #680.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions