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 src/Cargo.lock

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

2 changes: 1 addition & 1 deletion src/wxc_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ getrandom = { workspace = true }
semver = "1"

[target.'cfg(target_arch = "x86_64")'.dependencies]
hyperlight-unikraft-host = { git = "https://github.com/hyperlight-dev/hyperlight-unikraft", tag = "v0.5.0", optional = true }
hyperlight-unikraft-host = { git = "https://github.com/hyperlight-dev/hyperlight-unikraft", tag = "v0.6.0", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
windows = { workspace = true }
Expand Down
15 changes: 13 additions & 2 deletions src/wxc_common/src/hyperlight_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub fn setup(force: bool, logger: &mut Logger) -> Result<PathBuf, String> {
let opts = pyhl::InstallOptions {
home: &home,
source: pyhl::InstallSource::Ghcr {
tag: Some("v0.5.0"),
tag: Some("v0.6.0"),
},
mounts: &[],
network: None,
Expand Down Expand Up @@ -536,7 +536,18 @@ impl ScriptRunner for HyperlightScriptRunner {
}
};

match rt.run_code(&request.script_code) {
let result = if request.script_timeout > 0 {
let timeout = std::time::Duration::from_millis(u64::from(request.script_timeout));
logger.log_line(&format!(
"hyperlight: timeout set to {}ms",
request.script_timeout
));
rt.run_code_with_timeout(&request.script_code, timeout)
} else {
rt.run_code(&request.script_code)
};

match result {
Ok(timing) => {
logger.log_line(&format!(
"hyperlight: run ok (restore={:.1}ms call={:.1}ms exit={})",
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 @@ -622,6 +622,12 @@ fn hyperlight_suite() {
expected_exit: 0,
output_contains: Some("BLOCKED"),
},
HyperlightCase {
config: "hyperlight_timeout.json",
description: "time.sleep(120) killed by 1s timeout",
expected_exit: -1,
output_contains: Some("timed out"),
},
Comment thread
danbugs marked this conversation as resolved.
];

let mut failures = Vec::new();
Expand Down
7 changes: 7 additions & 0 deletions test_configs/hyperlight_timeout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"process": {
"commandLine": "import time; time.sleep(120); print('should not reach here')",
"timeout": 1000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this timeout for the first cold launch?

},
"containment": "hyperlight"
}
Loading