Skip to content

Commit 7a3fd26

Browse files
committed
Some tests logs
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 3d9ce58 commit 7a3fd26

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ test-integration target=default-target features="":
235235
{{ cargo-cmd }} test {{ if features =="" {"--features executable_heap"} else if features=="no-default-features" {"--no-default-features --features executable_heap"} else {"--no-default-features -F executable_heap," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test integration_test execute_on_heap
236236

237237
@# run the rest of the integration tests
238-
{{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test '*'
238+
{{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test '*' -- --nocapture
239239

240240
# tests compilation with no default features on different platforms
241241
test-compilation-no-default-features target=default-target:

src/hyperlight_host/tests/integration_test.rs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,8 @@ fn interrupt_random_kill_stress_test() {
968968
NUM_THREADS, ITERATIONS_PER_THREAD
969969
);
970970

971+
let start_time = std::time::Instant::now();
972+
971973
// Spawn worker threads
972974
let mut thread_handles = vec![];
973975
for thread_id in 0..NUM_THREADS {
@@ -1221,11 +1223,15 @@ fn interrupt_random_kill_stress_test() {
12211223

12221224
// Progress reporting
12231225
let current_total = total_iterations_clone.load(Ordering::Relaxed);
1224-
if current_total.is_multiple_of(5000) {
1226+
if current_total.is_multiple_of(1000) {
1227+
let elapsed = start_time.elapsed();
12251228
println!(
1226-
"Progress: {}/{} iterations completed",
1229+
"Progress: {}/{} iterations ({:.1}s elapsed, {} restores, {} replacements)",
12271230
current_total,
1228-
NUM_THREADS * ITERATIONS_PER_THREAD
1231+
NUM_THREADS * ITERATIONS_PER_THREAD,
1232+
elapsed.as_secs_f64(),
1233+
actually_killed_count_clone.load(Ordering::Relaxed),
1234+
sandbox_replaced_count_clone.load(Ordering::Relaxed),
12291235
);
12301236
}
12311237

@@ -1721,14 +1727,19 @@ fn fill_heap_and_cause_exception() {
17211727
#[test]
17221728
#[cfg(target_os = "windows")]
17231729
fn interrupt_cancel_delete_race() {
1730+
use std::sync::atomic::AtomicUsize;
1731+
17241732
const NUM_THREADS: usize = 8;
17251733
const NUM_KILL_THREADS: usize = 4;
17261734
const ITERATIONS_PER_THREAD: usize = 1000;
17271735

1736+
let total_iterations = Arc::new(AtomicUsize::new(0));
1737+
let start_time = std::time::Instant::now();
17281738
let mut handles = vec![];
17291739

17301740
for _ in 0..NUM_THREADS {
1731-
handles.push(thread::spawn(|| {
1741+
let total_iterations_clone = Arc::clone(&total_iterations);
1742+
handles.push(thread::spawn(move || {
17321743
for _ in 0..ITERATIONS_PER_THREAD {
17331744
let mut sandbox = new_rust_sandbox();
17341745
let interrupt_handle = sandbox.interrupt_handle();
@@ -1760,6 +1771,16 @@ fn interrupt_cancel_delete_race() {
17601771
for kill_handle in kill_handles {
17611772
kill_handle.join().expect("Kill thread panicked!");
17621773
}
1774+
1775+
let current = total_iterations_clone.fetch_add(1, Ordering::Relaxed) + 1;
1776+
if current % 500 == 0 {
1777+
println!(
1778+
"interrupt_cancel_delete_race: {}/{} iterations ({:.1}s elapsed)",
1779+
current,
1780+
NUM_THREADS * ITERATIONS_PER_THREAD,
1781+
start_time.elapsed().as_secs_f64(),
1782+
);
1783+
}
17631784
}
17641785
}));
17651786
}

0 commit comments

Comments
 (0)