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
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
# See https://x.com/Brooooook_lyn/status/1895848334692401270
[target.'cfg(target_env = "gnu")']
rustflags = ["-C", "link-args=-Wl,-z,nodelete"]

[target.wasm32-wasip1-threads]
rustflags = ["-Clink-args=-zstack-size=64000000 --max-memory=4294967296"]
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
files: .

wasm32-wasip1:
name: Check wasm32-wasip1
name: Test wasm32-wasip1
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
Expand All @@ -70,11 +70,17 @@ jobs:
with:
cache-key: wasm32-wasip1
save-cache: ${{ github.ref_name == 'main' }}
tools: wasmtime

- name: Check
run: |
rustup target add wasm32-wasip1
cargo check --all-features --target wasm32-wasip1
- uses: ./.github/actions/pnpm

- name: Install target
run: rustup target add wasm32-wasip1

- name: Test
run: cargo test --target wasm32-wasip1 --profile wasm-test -- --nocapture
env:
CARGO_TARGET_WASM32_WASIP1_RUNNER: "wasmtime run -W bulk-memory=y --dir ${{ github.workspace }}::/ --"

wasm32-unknown-unknown:
name: Check wasm32-unknown-unknown
Expand Down Expand Up @@ -102,6 +108,7 @@ jobs:
with:
cache-key: wasi
save-cache: ${{ github.ref_name == 'main' }}
tools: wasmtime

- uses: ./.github/actions/pnpm

Expand All @@ -115,4 +122,9 @@ jobs:
env:
WASI_TEST: 1

- name: Cargo Test
run: cargo test --target wasm32-wasip1-threads --profile wasm-test -- --nocapture
env:
CARGO_TARGET_WASM32_WASIP1_THREADS_RUNNER: "wasmtime run -W bulk-memory=y -W threads=y -S threads=y --dir ${{ github.workspace }}::/ --"

- run: git diff --exit-code # Must commit index.d.ts
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ debug = false
# and we don't rely on it for debugging that much.
debug = false

[profile.wasm-test]
inherits = "test"
debug = true
opt-level = "z" # Avoid too many locals errors during wasmtime testing

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Expand Down
1 change: 1 addition & 0 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn fixture() -> PathBuf {
}

#[test]
#[cfg_attr(target_os = "wasi", ignore)]
fn threaded_environment() {
let cwd = env::current_dir().unwrap();
let resolver = Arc::new(Resolver::default());
Expand Down
5 changes: 5 additions & 0 deletions src/tests/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(
FileType::File => std::os::windows::fs::symlink_file(original.as_ref().normalize(), link),
FileType::Dir => std::os::windows::fs::symlink_dir(original.as_ref().normalize(), link),
}
#[cfg(target_family = "wasm")]
{
Err(io::Error::new(io::ErrorKind::Other, "not supported"))
}
}

fn init(dirname: &Path, temp_path: &Path) -> io::Result<()> {
Expand Down Expand Up @@ -119,6 +123,7 @@ fn prepare_symlinks<P: AsRef<Path>>(
}

#[test]
#[cfg_attr(target_family = "wasm", ignore)]
fn test() {
let Some(SymlinkFixturePaths { root, temp_path }) = prepare_symlinks("temp").unwrap() else {
return;
Expand Down