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
11 changes: 6 additions & 5 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ build target=default-target:
# build testing guest binaries
guests: build-and-move-rust-guests build-and-move-c-guests

ensure-cargo-hyperlight:
command -v cargo-hyperlight >/dev/null 2>&1 || cargo install --locked cargo-hyperlight

witguest-wit:
command -v wasm-tools >/dev/null 2>&1 || cargo install --locked wasm-tools
cd src/tests/rust_guests/witguest && wasm-tools component wit guest.wit -w -o interface.wasm
cd src/tests/rust_guests/witguest && wasm-tools component wit two_worlds.wit -w -o twoworlds.wasm

build-rust-guests target=default-target features="": (witguest-wit)
command -v cargo-hyperlight >/dev/null 2>&1 || cargo install --locked cargo-hyperlight
build-rust-guests target=default-target features="": (witguest-wit) (ensure-cargo-hyperlight)
cd src/tests/rust_guests/simpleguest && cargo hyperlight build {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }}
cd src/tests/rust_guests/dummyguest && cargo hyperlight build {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }}
cd src/tests/rust_guests/witguest && cargo hyperlight build {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }}
Expand Down Expand Up @@ -259,8 +261,7 @@ clippy target=default-target: (witguest-wit)
clippyw target=default-target: (witguest-wit)
{{ cargo-cmd }} clippy --all-targets --all-features --target x86_64-pc-windows-gnu --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings

clippy-guests target=default-target: (witguest-wit)
command -v cargo-hyperlight >/dev/null 2>&1 || cargo install --locked cargo-hyperlight
clippy-guests target=default-target: (witguest-wit) (ensure-cargo-hyperlight)
cd src/tests/rust_guests/simpleguest && cargo hyperlight clippy --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings
cd src/tests/rust_guests/witguest && cargo hyperlight clippy --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings

Expand Down Expand Up @@ -314,7 +315,7 @@ tar-headers: (build-rust-capi) # build-rust-capi is a dependency because we need
tar -zcvf include.tar.gz -C {{root}}/src/hyperlight_guest_bin/third_party/ musl/include musl/arch/x86_64 printf/printf.h -C {{root}}/src/hyperlight_guest_capi include

tar-static-lib: (build-rust-capi "release") (build-rust-capi "debug")
tar -zcvf hyperlight-guest-c-api-linux.tar.gz -C {{root}}/target/x86_64-unknown-none/ release/libhyperlight_guest_capi.a -C {{root}}/target/x86_64-unknown-none/ debug/libhyperlight_guest_capi.a
tar -zcvf hyperlight-guest-c-api-linux.tar.gz -C {{root}}/target/x86_64-hyperlight-none/ release/libhyperlight_guest_capi.a -C {{root}}/target/x86_64-hyperlight-none/ debug/libhyperlight_guest_capi.a

# Create release notes for the given tag. The expected format is a v-prefixed version number, e.g. v0.2.0
# For prereleases, the version should be "dev-latest"
Expand Down
6 changes: 3 additions & 3 deletions c.just
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ c-flags-release-elf := '-O3'

build-c-guests target=default-target: (build-rust-capi target) (compile-c-guest target) (link-c-guest target)

build-rust-capi target=default-target:
cd src/hyperlight_guest_capi && cargo build --profile {{ if target == "debug" { "dev" } else { target } }}
build-rust-capi target=default-target: (ensure-cargo-hyperlight)
cd src/hyperlight_guest_capi && cargo hyperlight build --profile {{ if target == "debug" { "dev" } else { target } }}

compile-c-guest target=default-target:
# elf
cd src/tests/c_guests/c_simpleguest && {{ mkdir }} "./out/{{target}}" && clang -c {{ c-compile-options-elf }} {{ if target == "debug" { c-flags-debug-elf } else { c-flags-release-elf } }} main.c {{c-include-flags-elf}} -o "out/{{ target }}/main.o"

link-c-guest target=default-target:
# elf
cd src/tests/c_guests/c_simpleguest && ld.lld -o out/{{target}}/simpleguest {{c-linker-options-elf}} out/{{target}}/main.o -l hyperlight_guest_capi -L "{{justfile_directory()}}/target/x86_64-unknown-none/{{target}}"
cd src/tests/c_guests/c_simpleguest && ld.lld -o out/{{target}}/simpleguest {{c-linker-options-elf}} out/{{target}}/main.o -l hyperlight_guest_capi -L "{{justfile_directory()}}/target/x86_64-hyperlight-none/{{target}}"

move-c-guests target=default-target:
# elf
Expand Down
8 changes: 0 additions & 8 deletions src/hyperlight_guest_capi/.cargo/config.toml

This file was deleted.

8 changes: 0 additions & 8 deletions src/hyperlight_host/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,6 @@ fn test_if_guest_is_able_to_get_bool_return_values_from_host() {

/// Tests whether host is able to return Float/f32 as return type
/// or not
/// Adding Ignore attribute, due known issues with float and double
/// calculations - see Github issue #179. Once it is fixed we can
/// remove ignore attribute
#[ignore]
#[test]
fn test_if_guest_is_able_to_get_float_return_values_from_host() {
let mut sbox1 = new_uninit_c().unwrap();
Expand All @@ -870,10 +866,6 @@ fn test_if_guest_is_able_to_get_float_return_values_from_host() {

/// Tests whether host is able to return Double/f64 as return type
/// or not
/// Adding Ignore attribute, due known issues with float and double
/// calculations - see Github issue #179. Once it is fixed we can
/// remove ignore attribute
#[ignore]
#[test]
fn test_if_guest_is_able_to_get_double_return_values_from_host() {
let mut sbox1 = new_uninit_c().unwrap();
Expand Down
11 changes: 8 additions & 3 deletions src/hyperlight_host/tests/sandbox_host_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ fn pass_byte_array() {
}

#[test]
#[ignore = "Fails with mismatched float only when c .exe guest?!"]
fn float_roundtrip() {
let doubles = [
0.0,
Expand Down Expand Up @@ -83,8 +82,11 @@ fn float_roundtrip() {
for f in doubles.iter() {
let res: f64 = sandbox.call("EchoDouble", *f).unwrap();

// Use == for comparison (handles -0.0 == 0.0) with special case for NaN.
// Note: FlatBuffers doesn't preserve -0.0 (-0.0 round-trips to 0.0) because FlatBuffers skips
// storing values equal to the default (as an optimization), and -0.0 == 0.0 in IEEE 754.
assert!(
res.total_cmp(f).is_eq(),
(res.is_nan() && f.is_nan()) || res == *f,
"Expected {:?} but got {:?}",
f,
res
Expand All @@ -93,8 +95,11 @@ fn float_roundtrip() {
for f in floats.iter() {
let res: f32 = sandbox.call("EchoFloat", *f).unwrap();

// Use == for comparison (handles -0.0 == 0.0) with special case for NaN.
// Note: FlatBuffers doesn't preserve -0.0 (-0.0 round-trips to 0.0) because FlatBuffers skips
// storing values equal to the default (as an optimization), and -0.0 == 0.0 in IEEE 754.
assert!(
res.total_cmp(f).is_eq(),
(res.is_nan() && f.is_nan()) || res == *f,
"Expected {:?} but got {:?}",
f,
res
Expand Down
4 changes: 2 additions & 2 deletions src/tests/rust_guests/witguest/Cargo.lock

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