You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
runtime adapter: turn the host program's exit statuses into an enum #906
runtime-adapter-host reports how a command ended through its exit status, which its module documentation, tests/runtime-adapter/README.md, and its tests rely on. The statuses are defined in four ways, across two files:
Status
Meaning
Definition
0
the command did what it was asked
ExitCode::SUCCESS
1
the command failed, after a diagnostic on standard error
Nothing ties them together: a new status could take a number that another one already has, a reader has to collect them from the binary's constants, main, and the hook module, and the tests repeat the numbers, as tests/vm_layered.rs does with a ROOT_FAILED of its own.
Proposal
Add an enum of the host program's exit statuses, for example HostExit, with a variant for each status above and its number in one place, such as a #[repr(u8)] enum with impl From<HostExit> for std::process::ExitCode.
Make the commands return it, in place of the ExitCodes that they build from constants and literals, and make the step hook exit with its value for status 5.
Define it in the adapter's library, beside the step hook, so that the tests name the statuses instead of repeating their numbers.
Requirements
Keep each status's number and meaning: the scenarios and the VM suites check them.
Keep the binary's module documentation and tests/runtime-adapter/README.md in step with the enum.
Validation
The runtime adapter's protocol-only and host-only checks in check-nvx-rs, on Linux and Windows, and its VM suites, vm_layered, vm_restart, and vm_steps, which CI runs on KVM, MSHV, and WHP.
Activity