Skip to content

Commit e19c5ba

Browse files
claudebranchseer
authored andcommitted
fix(fspy): skip static_executable tests on musl
The test binary is an artifact dep targeting musl, and when CI builds with -crt-static the binary becomes dynamically linked — defeating the purpose of these static-binary-specific tests. https://claude.ai/code/session_01R3RoGqPDBRtNa2NRg3SeBM
1 parent ccf5fb4 commit e19c5ba

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

crates/fspy/tests/static_executable.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#![cfg(target_os = "linux")]
1+
//! Tests for fspy tracing of statically-linked executables (seccomp path).
2+
//! Skipped on musl: the test binary is an artifact dep targeting musl, and when
3+
//! the CI builds with `-crt-static` the binary becomes dynamically linked,
4+
//! defeating the purpose of these tests.
5+
#![cfg(all(target_os = "linux", not(target_env = "musl")))]
26
use std::{
37
fs::{self, Permissions},
48
os::unix::fs::PermissionsExt as _,
@@ -18,11 +22,11 @@ const TEST_BIN_CONTENT: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_FSPY_TEST_BI
1822

1923
fn test_bin_path() -> &'static Path {
2024
static TEST_BIN_PATH: LazyLock<PathBuf> = LazyLock::new(|| {
21-
// On musl with -crt-static (dynamic linking), the artifact dep is also
22-
// dynamically linked. The seccomp tracer works for both static and
23-
// dynamic binaries, so the tests are still valid either way.
24-
let is_dynamic = is_dynamically_linked_to_libc(TEST_BIN_CONTENT);
25-
assert!(is_dynamic.is_ok(), "Failed to inspect test binary: {is_dynamic:?}");
25+
assert_eq!(
26+
is_dynamically_linked_to_libc(TEST_BIN_CONTENT),
27+
Ok(false),
28+
"Test binary is not a static executable"
29+
);
2630

2731
let tmp_dir = env!("CARGO_TARGET_TMPDIR");
2832
let test_bin_path = PathBuf::from(tmp_dir).join("fspy-test-bin");

0 commit comments

Comments
 (0)