Skip to content

sort: cap automatic buffer size on 32-bit targets #17923

sort: cap automatic buffer size on 32-bit targets

sort: cap automatic buffer size on 32-bit targets #17923

Workflow file for this run

# spell-checker:ignore wasip wasmtime taiki
name: WASI
# spell-checker:ignore TRIGGERPATH
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
# End the current execution if there is a new changeset in the PR.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test_wasi:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
job:
- { target: wasm32-wasip1, rust-flags: "--cfg wasi_runner" }
- { target: wasm32-wasip2, rust-flags: "--cfg wasi_runner --cfg wasip2_runner" }
steps: &wasi_steps
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
- uses: Swatinem/rust-cache@v2
with:
key: "${{ matrix.job.target }}"
- name: Install wasmtime
uses: taiki-e/install-action@v2
with:
tool: wasmtime
- name: Run unit tests
env:
CARGO_TARGET_WASM32_WASIP1_RUNNER: wasmtime
CARGO_TARGET_WASM32_WASIP2_RUNNER: wasmtime
# Trace WASI syscalls (strace-style) when Actions step debug logging is on;
# verbose, so off otherwise.
WASMTIME_LOG: ${{ runner.debug == '1' && 'wasmtime_wasi=trace' || '' }}
WASMTIME_LOG_NO_CONTEXT: ${{ runner.debug == '1' && '1' || '' }}
run: |
cargo test --target ${{ matrix.job.target }} --no-default-features \
$(cargo tree --depth 1 --format "{lib}" --features=feat_wasm --prefix none | sed -n 's/^uu_/-p &/p')
- name: Run uucore fs unit tests
env:
# The fs tests touch the filesystem, so wasmtime must preopen a
# directory; map the host cwd to the guest root so the tests' relative
# scratch directories resolve.
CARGO_TARGET_WASM32_WASIP1_RUNNER: wasmtime --dir=.::/ --
CARGO_TARGET_WASM32_WASIP2_RUNNER: wasmtime --dir=.::/ --
run: |
cargo test --target ${{ matrix.job.target }} --no-default-features --features fs -p uucore fs::tests
- name: Run integration tests via wasmtime
if: matrix.job.target == 'wasm32-wasip1'
env:
RUSTFLAGS: ${{ matrix.job.rust-flags }}
run: |
# Build the WASI binary
cargo build --target ${{ matrix.job.target }} --no-default-features --features feat_wasm
# Run host-compiled integration tests against the WASI binary.
# Tests incompatible with WASI are annotated with
# #[uutests::wasi_ignore(ReasonKey)] in the test source files, which
# expands to #[cfg_attr(wasi_runner, ignore = "...")]. Tests that fail
# only on wasm32-wasip2 use #[uutests::wasip2_ignore(ReasonKey)], which
# expands to the same attribute for wasip2_runner. The reason keys live
# in tests/uutests_procs/src/lib.rs.
# The binary above is built without default features, so it has no
# caret diagnostics; the host test crate does have them, hence the
# not(wasi_runner) in the cfg guarding every `mod diagnostics`.
# TODO: add integration tests for these tools as WASI support is extended:
# csplit rm sort
# nproc is not part of the default feature set, so it needs to be
# requested explicitly for the host test crate to compile its tests.
UUTESTS_BINARY_PATH="$(pwd)/target/${{ matrix.job.target }}/debug/coreutils.wasm" \
UUTESTS_WASM_RUNNER=wasmtime \
cargo test --test tests --features nproc -- \
test_arch:: test_b2sum:: test_base32:: test_base64:: test_basenc:: \
test_basename:: test_cat:: test_cksum:: test_comm:: test_cp:: test_cut:: test_date:: \
test_dir:: test_dircolors:: test_dirname:: test_echo:: test_expand:: test_expr:: \
test_factor:: test_false:: test_fmt:: test_fold:: test_head:: test_join:: test_link:: test_ln:: \
test_ls:: \
test_md5sum:: test_mkdir:: test_mktemp:: test_mv:: test_nl:: test_nproc:: test_numfmt:: test_od:: \
test_paste:: test_pathchk:: test_pr:: test_printenv:: test_printf:: test_ptx:: \
test_pwd:: test_readlink:: test_realpath:: test_rmdir:: test_seq:: test_sha1sum:: test_sha224sum:: test_sha256sum:: \
test_sha384sum:: test_sha512sum:: test_shred:: test_shuf:: test_sleep:: \
test_sort::sort_multiple test_sort::test_check test_split:: test_sum:: test_tail:: test_tee:: \
test_test:: test_touch:: test_tr:: test_true:: test_truncate:: test_tsort:: test_uname:: \
test_uniq:: test_unexpand:: test_unlink:: test_vdir:: test_wc:: test_yes::
# WASI tests on non-Linux hosts. These catch host-specific wasmtime differences
test_wasi_other_host:
name: Tests Non-Linux Host
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: macos-latest, target: wasm32-wasip1, rust-flags: "--cfg wasi_runner" }
steps: *wasi_steps