Skip to content

Commit

Permalink
Minor fixups in CI example tests
Browse files Browse the repository at this point in the history
- The target triple wasn't being passed to the example-based tests.
    - Disable the ipc/server example on musl
- Very slightly tighten the bindmounts in the network Isolate test
  • Loading branch information
boustrophedon committed Apr 12, 2024
1 parent dd29e1d commit e385f04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ test:
test-ci:
cargo test --target=$(TARGET_TRIPLE) --tests --examples --all-features
cargo test --target=$(TARGET_TRIPLE) --tests --examples --no-default-features
cargo run --all-features --example isolate_test
cargo run --all-features --example ipc_server_with_database
cargo run --target=$(TARGET_TRIPLE) --all-features --example isolate_test
cargo run --target=$(TARGET_TRIPLE) --all-features --example ipc_server_with_database

# Run clippy
lint:
Expand Down
5 changes: 5 additions & 0 deletions examples/ipc_server_with_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ fn run_client_read() {
});
}

#[cfg(target_env = "musl")]
fn main() {
println!("without building sqlite from source we can't link to sqlite, but it would be annoying to build it in CI.");
}
#[cfg(not(target_env = "musl"))]
fn main() {
let args: Vec<String> = std::env::args().collect();
println!("main args: {:?}", args);
Expand Down
7 changes: 5 additions & 2 deletions examples/isolate_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,16 @@ fn network_call() {

fn isolate_with_network(name: &'static str) -> Isolate {
Isolate::new(name, network_call)
// Just mount all of / because ssl and dns files are all over the place.
// ssl and dns files are all over the place.
// If you wanted you could further restrict it via landlock or by mounting only specific
// files and directories but it highly depends on your operating system and DNS setup. One
// thing in particular to note is that if a file exists but it's a symlink to somewhere
// outside the filesystem, something (e.g. openssl) might see that the file is there and
// it can stat it, but then will try to read the file and crash.
.add_bind_mount("/", "/")
.add_bind_mount("/etc", "/etc")
.add_bind_mount("/usr", "/usr")
.add_bind_mount("/run", "/run")
.add_bind_mount("/lib", "/lib")
.new_network(false)
}

Expand Down

0 comments on commit e385f04

Please sign in to comment.