Skip to content

Commit ec68dde

Browse files
committed
Run thread-heavy tests serially
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 160f7cf commit ec68dde

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

Justfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ test-integration guest target=default-target features="":
228228
{{if os() == "windows" { "$env:" } else { "" } }}GUEST="{{guest}}"{{if os() == "windows" { ";" } else { "" } }} {{ cargo-cmd }} test --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test integration_test execute_on_heap {{ if features =="" {""} else {"--features " + features} }} -- --ignored
229229

230230
@# run the rest of the integration tests
231-
@# skip interrupt_random_kill_stress_test and then run it explicitly so we can see the output more
232-
{{if os() == "windows" { "$env:" } else { "" } }}GUEST="{{guest}}"{{if os() == "windows" { ";" } else { "" } }} {{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F init-paging," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test '*' -- --skip interrupt_random_kill_stress_test
233-
{{if os() == "windows" { "$env:" } else { "" } }}GUEST="{{guest}}"{{if os() == "windows" { ";" } else { "" } }} {{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F init-paging," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test integration_test interrupt_random_kill_stress_test -- --nocapture --exact
231+
{{if os() == "windows" { "$env:" } else { "" } }}GUEST="{{guest}}"{{if os() == "windows" { ";" } else { "" } }} {{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F init-paging," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test '*'
234232

235233
# tests compilation with no default features on different platforms
236234
test-compilation-no-default-features target=default-target:

src/hyperlight_host/tests/integration_test.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use hyperlight_host::{GuestBinary, HyperlightError, MultiUseSandbox, Uninitializ
2525
use hyperlight_testing::simplelogger::{LOGGER, SimpleLogger};
2626
use hyperlight_testing::{c_simple_guest_as_string, simple_guest_as_string};
2727
use log::LevelFilter;
28+
use serial_test::serial;
2829

2930
pub mod common; // pub to disable dead_code warning
3031
use crate::common::{new_uninit, new_uninit_c, new_uninit_rust};
@@ -293,6 +294,7 @@ fn interrupt_moved_sandbox() {
293294
/// The ABA-problem is solved by clearing CANCEL bit at the start of each VirtualCPU::run() call.
294295
#[test]
295296
#[cfg(target_os = "linux")]
297+
#[serial(thread_heavy)]
296298
fn interrupt_custom_signal_no_and_retry_delay() {
297299
let mut config = SandboxConfiguration::default();
298300
config.set_interrupt_vcpu_sigrtmin_offset(0).unwrap();
@@ -315,8 +317,8 @@ fn interrupt_custom_signal_no_and_retry_delay() {
315317
let thread = thread::spawn(move || {
316318
for _ in 0..NUM_ITERS {
317319
// wait for the guest call to start
318-
thread::sleep(Duration::from_millis(1000));
319-
interrupt_handle.kill();
320+
thread::sleep(Duration::from_millis(3000));
321+
assert!(interrupt_handle.kill());
320322
}
321323
});
322324

@@ -864,6 +866,7 @@ fn test_if_guest_is_able_to_get_string_return_values_from_host() {
864866
/// - Calls we did NOT choose to kill NEVER return ExecutionCanceledByHost
865867
/// - We get a mix of killed and non-killed outcomes (not 100% or 0%)
866868
#[test]
869+
#[serial(thread_heavy)]
867870
fn interrupt_random_kill_stress_test() {
868871
// Wrapper to hold a sandbox and its snapshot together
869872
struct SandboxWithSnapshot {
@@ -1334,6 +1337,7 @@ fn interrupt_random_kill_stress_test() {
13341337
///
13351338
/// **Failure Condition:** If this test hangs, it means `kill()` failed to stop the guest, leaving it spinning forever.
13361339
#[test]
1340+
#[serial(thread_heavy)]
13371341
fn interrupt_infinite_loop_stress_test() {
13381342
use std::sync::{Arc, Barrier};
13391343
use std::thread;
@@ -1421,6 +1425,7 @@ fn interrupt_infinite_loop_stress_test() {
14211425
// mid-call and shares a thread ID with another sandbox, ensuring only the intended
14221426
// VM is interrupted while bait sandboxes keep running.
14231427
#[test]
1428+
#[serial(thread_heavy)]
14241429
fn interrupt_infinite_moving_loop_stress_test() {
14251430
use std::sync::Arc;
14261431
use std::thread;

0 commit comments

Comments
 (0)