Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/hyperlight-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
$pyhlHome = Join-Path $env:LOCALAPPDATA "pyhl"
New-Item -ItemType Directory -Force -Path $pyhlHome | Out-Null

.\crane.exe export ghcr.io/danbugs/hyperlight-unikraft/python-agent-driver-kernel:latest kernel.tar
.\crane.exe export ghcr.io/hyperlight-dev/hyperlight-unikraft/python-agent-driver-kernel:latest kernel.tar
tar -xf kernel.tar -C $pyhlHome kernel

.\crane.exe export ghcr.io/danbugs/hyperlight-unikraft/python-agent-driver-initrd:latest initrd.tar
.\crane.exe export ghcr.io/hyperlight-dev/hyperlight-unikraft/python-agent-driver-initrd:latest initrd.tar
tar -xf initrd.tar -C $pyhlHome initrd.cpio

Write-Host "Downloaded to ${pyhlHome}:"
Expand Down
4 changes: 3 additions & 1 deletion src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/wxc_common/src/hyperlight_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@
//!
//! ## Exit codes
//!
//! 0 on clean `run_code` completion, -1 on any error (preflight, install,
//! runtime, guest crash). The specific failure mode is in `error_message`.
//! Guest exit code on clean `run_code` completion (0 for normal exit,
//! non-zero for `sys.exit(N)` or unhandled exceptions), -1 on any
//! runner error (preflight, install, runtime, guest crash). The specific
//! failure mode is in `error_message`.

use std::path::{Path, PathBuf};

Expand Down Expand Up @@ -474,11 +476,11 @@ impl ScriptRunner for HyperlightScriptRunner {
match rt.run_code(&request.script_code) {
Ok(timing) => {
logger.log_line(&format!(
"hyperlight: run ok (restore={:.1}ms call={:.1}ms)",
timing.restore_ms, timing.call_ms
"hyperlight: run ok (restore={:.1}ms call={:.1}ms exit={})",
timing.restore_ms, timing.call_ms, timing.exit_code
));
ScriptResponse {
exit_code: 0,
exit_code: timing.exit_code,
..Default::default()
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/wxc_e2e_tests/tests/e2e_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,12 @@ fn hyperlight_suite() {
expected_exit: 0,
output_contains: Some("'x':"),
},
HyperlightCase {
config: "hyperlight_exit_code.json",
description: "sys.exit(42) propagates exit code",
expected_exit: 42,
output_contains: None,
},
];

let mut failures = Vec::new();
Expand Down
7 changes: 7 additions & 0 deletions test_configs/hyperlight_exit_code.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"process": {
"commandLine": "import sys; sys.exit(42)",
"timeout": 30000
},
"containment": "hyperlight"
}
Loading