diff --git a/.cargo/config.toml.cross-wasm32p1 b/.cargo/config.toml.cross-wasm32p1 new file mode 100644 index 000000000..5bcf55317 --- /dev/null +++ b/.cargo/config.toml.cross-wasm32p1 @@ -0,0 +1,2 @@ +[target.wasm32-wasip1] +runner = "wasmtime --dir . --dir src --dir /" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec61c8445..8328ea685 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -229,6 +229,9 @@ jobs: targets: wasm32-wasip1 - uses: Swatinem/rust-cache@v2 - run: cargo build --target wasm32-wasip1 + # -p libwild prevents integration tests from running. they depend on + # spawning processes, which isn't supported on wasi. + - run: cargo test --profile ci -p libwild spelling: name: Spell Check with Typos diff --git a/libwild/src/args/elf.rs b/libwild/src/args/elf.rs index 711b8750b..623f8018b 100644 --- a/libwild/src/args/elf.rs +++ b/libwild/src/args/elf.rs @@ -2098,6 +2098,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "wasi", ignore = "wasi doesn't have a temp dir")] fn test_parse_file_only_options() { // Create a temporary file containing the same options (one per line) as INPUT1 let file = NamedTempFile::new().expect("Could not create temp file"); @@ -2111,6 +2112,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "wasi", ignore = "wasi doesn't have a temp dir")] fn test_parse_mixed_file_and_inline_options() { // Create a temporary file containing some options let file = NamedTempFile::new().expect("Could not create temp file"); @@ -2130,6 +2132,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "wasi", ignore = "wasi doesn't have a temp dir")] fn test_parse_overlapping_file_and_inline_options() { // Create a set of file options that has a duplicate of an inline option let mut file_options = FILE_OPTIONS.to_vec(); @@ -2152,6 +2155,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "wasi", ignore = "wasi doesn't have a temp dir")] fn test_parse_recursive_file_option() { // Create a temporary file containing a @file option let file1 = NamedTempFile::new().expect("Could not create temp file"); diff --git a/libwild/src/layout.rs b/libwild/src/layout.rs index 1180c079e..163d43f1c 100644 --- a/libwild/src/layout.rs +++ b/libwild/src/layout.rs @@ -4902,7 +4902,10 @@ fn test_no_disallowed_overlaps() { output_sections.output_order(crate::output_kind::OutputKind::StaticExecutable( crate::args::RelocationModel::NonRelocatable, )); - let args = crate::args::elf::ElfArgs::default(); + let mut args = crate::args::elf::ElfArgs::default(); + if args.arch == crate::arch::Architecture::Unsupported { + args.arch = crate::arch::Architecture::X86_64; + } let section_part_sizes = output_sections.new_part_map::().map(|_, _| 7); let section_part_layouts = layout_section_parts::( diff --git a/wild/Cargo.toml b/wild/Cargo.toml index 403bb311c..10f1dc226 100644 --- a/wild/Cargo.toml +++ b/wild/Cargo.toml @@ -42,9 +42,11 @@ serde-keyvalue = { workspace = true } strum = { workspace = true } tempfile = { workspace = true } toml = { workspace = true } -wait-timeout = { workspace = true } which = { workspace = true } +[target.'cfg(not(target_os = "wasi"))'.dev-dependencies] +wait-timeout = { workspace = true } + [features] default = ["fork"]