Skip to content

Commit 35d89ac

Browse files
committed
Allow execute_on_heap to execute concurrently
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 817689f commit 35d89ac

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

Justfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,8 @@ test-isolated target=default-target features="" :
171171
{{ cargo-cmd }} test {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F function_call_metrics,init-paging," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} -p hyperlight-host --lib -- metrics::tests::test_metrics_are_emitted --exact
172172
# runs integration tests. Guest can either be "rust" or "c"
173173
test-integration guest target=default-target features="":
174-
@# run execute_on_heap test with feature "executable_heap" on and off
174+
@# run execute_on_heap test with feature "executable_heap" on (runs with off during normal tests)
175175
{{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 =="" {" --features executable_heap"} else {"--features executable_heap," + features} }} -- --ignored
176-
{{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
177176

178177
@# run the rest of the integration tests
179178
@# skip interrupt_random_kill_stress_test and then run it explicitly so we can see the output more

src/hyperlight_host/tests/integration_test.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -705,22 +705,22 @@ fn execute_on_stack() {
705705
}
706706

707707
#[test]
708-
#[ignore] // ran from Justfile because requires feature "executable_heap"
709708
fn execute_on_heap() {
710709
let mut sbox1 = new_uninit_rust().unwrap().evolve().unwrap();
711710
let result = sbox1.call::<String>("ExecuteOnHeap", ());
712711

713-
println!("{:#?}", result);
714712
#[cfg(feature = "executable_heap")]
715-
assert!(result.is_ok());
713+
assert_eq!(
714+
result.unwrap(),
715+
"Executed on heap successfully",
716+
"should execute successfully"
717+
);
716718

717719
#[cfg(not(feature = "executable_heap"))]
718-
{
719-
assert!(result.is_err());
720-
let err = result.unwrap_err();
721-
722-
assert!(err.to_string().contains("PageFault"));
723-
}
720+
assert!(
721+
result.unwrap_err().to_string().contains("PageFault"),
722+
"should get page fault"
723+
);
724724
}
725725

726726
// checks that a recursive function with stack allocation eventually fails with stackoverflow

src/tests/rust_guests/simpleguest/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ fn execute_on_heap() -> String {
489489
black_box(heap_fn); // avoid optimization when running in release mode
490490
}
491491
// will only reach this point if heap is executable
492-
String::from("fail")
492+
String::from("Executed on heap successfully")
493493
}
494494

495495
#[guest_function("TestMalloc")]

0 commit comments

Comments
 (0)