Skip to content

Commit baf50a8

Browse files
committed
[ci] fixup: Add checks for tracing features and run tracing tests
Signed-off-by: Doru Blânzeanu <[email protected]>
1 parent 53eafe8 commit baf50a8

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.github/workflows/dep_rust.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ jobs:
137137
cargo check -p hyperlight-host --features crashdump
138138
cargo check -p hyperlight-host --features print_debug
139139
cargo check -p hyperlight-host --features gdb
140+
cargo check -p hyperlight-host --features trace_guest,unwind_guest,mem_profile
140141
141142
# without any features
142143
just test-compilation-no-default-features ${{ matrix.config }}
@@ -169,6 +170,15 @@ jobs:
169170
RUST_LOG: debug
170171
run: just test-rust-crashdump ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
171172

173+
- name: Run Rust Tracing tests - linux
174+
if: runner.os == 'Linux'
175+
env:
176+
CARGO_TERM_COLOR: always
177+
RUST_LOG: debug
178+
# NOTE: This will rebuild the guests with the tracing feature enabled
179+
# Any assumptions about the guests being already built should be avoided
180+
run: just test-rust-tracing ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}}
181+
172182
- name: Download benchmarks from "latest"
173183
run: just bench-download ${{ runner.os }} ${{ matrix.hypervisor }} ${{ matrix.cpu}} dev-latest # compare to prerelease
174184
env:

Justfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,18 @@ test-like-ci config=default-target hypervisor="kvm":
8282
cargo check -p hyperlight-host --features crashdump
8383
cargo check -p hyperlight-host --features print_debug
8484
cargo check -p hyperlight-host --features gdb
85+
cargo check -p hyperlight-host --features trace_guest,unwind_guest,mem_profile
8586

8687
@# without any driver (should fail to compile)
8788
just test-compilation-no-default-features {{config}}
8889

8990
@# test the crashdump feature
9091
just test-rust-crashdump {{config}}
9192

93+
@# test the tracing related features
94+
@# Note: This will rebuild the guests with the tracing feature enabled
95+
just test-rust-tracing {{config}} {{ if hypervisor == "mshv3" {"mshv3"} else {""} }}
96+
9297
# runs all tests
9398
test target=default-target features="": (test-unit target features) (test-isolated target features) (test-integration "rust" target features) (test-integration "c" target features) (test-seccomp target features)
9499

@@ -141,6 +146,20 @@ test-rust-gdb-debugging target=default-target features="":
141146
test-rust-crashdump target=default-target features="":
142147
cargo test --profile={{ if target == "debug" { "dev" } else { target } }} {{ if features =="" {'--features crashdump'} else { "--features crashdump," + features } }} -- test_crashdump
143148

149+
# rust test for tracing
150+
test-rust-tracing target=default-target features="":
151+
# Run tests for the tracing guest and macro
152+
cargo test -p hyperlight-guest-tracing --profile={{ if target == "debug" { "dev" } else { target } }}
153+
cargo test -p hyperlight-guest-tracing-macro --profile={{ if target == "debug" { "dev" } else { target } }}
154+
155+
# Prepare the tracing guest for testing
156+
just build-rust-guests {{ target }} trace_guest
157+
just move-rust-guests {{ target }}
158+
# Run hello-world example with tracing enabled to get the trace output
159+
# Capture the trace file path and print use it afterwards to run cargo run -p trace_dump
160+
cargo run --profile={{ if target == "debug" { "dev" } else { target } }} --example hello-world --features {{ if features =="" {'trace_guest'} else { "trace_guest," + features } }} \
161+
| sed -n 's/.*Creating trace file at: \(.*\)/\1/p' \
162+
| xargs -I {} cargo run -p trace_dump ./{{ simpleguest_source }}/{{ target }}/simpleguest {} list_frames
144163

145164
################
146165
### LINTING ####

0 commit comments

Comments
 (0)