diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index cf808b8f556..806376e8f59 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -80,7 +80,9 @@ jobs: - { os: ubuntu-latest , features: feat_os_unix_redox , target: x86_64-unknown-redox } - { os: ubuntu-latest , features: feat_wasm , target: wasm32-wasip1 } - { os: ubuntu-latest , features: feat_wasm , target: wasm32-wasip2 } + - { os: ubuntu-latest , uu: 1 , features: feat_os_unix , target: x86_64-unknown-freebsd , arg: "--features=feat_diagnostics --all-targets -p coreutils" , cargo: cargo-zigbuild } - { os: ubuntu-latest , features: feat_os_unix , target: x86_64-unknown-netbsd , cargo: cargo-zigbuild } + # openbsd is covered at openbsd.yml to avoid building std twice steps: - uses: actions/checkout@v7.0.1 with: diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index bb0e906a736..d02104d2c37 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -1,10 +1,10 @@ name: FreeBSD -# spell-checker:ignore sshfs usesh vmactions taiki esac fdescfs fdesc nextest copyback logind +# spell-checker:ignore sshfs usesh vmactions taiki esac fdescfs fdesc mlugg nextest copyback logind zigbuild env: - # * style job configuration - STYLE_FAIL_ON_FAULT: true ## (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis + CARGO_INCREMENTAL: "0" + RUST_BACKTRACE: "1" on: pull_request: @@ -21,17 +21,19 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - style: - name: Style and Lint + test_zig: + name: test runs-on: ubuntu-latest timeout-minutes: 45 steps: + - name: Avoid no space left on device + shell: bash + run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android & - uses: actions/checkout@v7.0.1 with: persist-credentials: false - uses: dtolnay/rust-toolchain@stable with: - components: clippy targets: x86_64-unknown-freebsd - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache @@ -47,37 +49,27 @@ jobs: - uses: taiki-e/install-action@v2 with: tool: cargo-zigbuild - - name: cargo clippy - env: - CARGO_INCREMENTAL: "0" + - name: prepare testing run: | - UTILS=$(cargo tree --depth 1 --features feat_os_unix --format '{lib}' --prefix none | sed -n 's/^uu_/-p uu_/p') - cargo-zigbuild clippy --target x86_64-unknown-freebsd --features feat_os_unix -p coreutils ${UTILS} --all-targets --tests --benches -- -D warnings - - test: - name: Tests - runs-on: ubuntu-latest - timeout-minutes: 45 - env: - mem: 4096 - steps: - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - - name: Avoid no space left on device (Ubuntu runner) - shell: bash - run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android & - - name: Prepare, build and test + set -euo pipefail + # Use static openssl for zigbuild and ask downstream to use vendored one if they see any issue with system one. + # BSD make's redirection to GNUmakefile is tested at openbsd.yml + cargo-zigbuild test --target x86_64-unknown-freebsd --no-run --features feat_os_unix,openssl -p uucore -p coreutils --message-format=json \ + | jq -rs ' + [ .[] | select(.executable != null) | .executable | select(test("/coreutils$") | not) ] + | unique + | .[] + ' > tests.sh + cat tests.sh + - name: test uses: vmactions/freebsd-vm@v1.6.0 with: usesh: true sync: rsync copyback: false - prepare: pkg install -y gmake nextest rust sudo + prepare: pkg install -y sudo run: | - ## Prepare, build, and test - # implementation modelled after ref: - # * NOTE: All steps need to be run in this block, otherwise, we are operating back on the mac host + ## test set -e # # We need a file-descriptor file system to test test_ls::test_ls_io_errors @@ -105,29 +97,15 @@ jobs: echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'" echo "WORKSPACE='${WORKSPACE}'" env | sort - # tooling info - echo "## tooling info" - cargo -V - cargo nextest --version - rustc -V - # - # To ensure that files are cleaned up, we don't want to exit on error set +e cd "${WORKSPACE}" unset FAULT - export CARGO_INCREMENTAL=0 - export RUSTFLAGS="-C strip=symbols" # for disk space - # vendored OpenSSL takes many times to build. Use system one (LibreSSL is supported). - export OPENSSL_NO_VENDOR=1 OPENSSL_DIR=/usr - cargo build || FAULT=1 - export PATH=~/.cargo/bin:${PATH} + # tests fail without using this path by unknown reason + cp -v target/x86_64-unknown-freebsd/debug/coreutils /tmp/coreutils + export UUTESTS_BINARY_PATH=/tmp/coreutils export RUST_BACKTRACE=1 - export CARGO_TERM_COLOR=always - if (test -z "\$FAULT"); then cargo nextest run --hide-progress-bar --profile ci --features feat_os_unix || FAULT=1 ; fi - if (test -z "\$FAULT"); then cargo nextest run --hide-progress-bar --profile ci --all-features -p uucore || FAULT=1 ; fi - # Test building with make - if (test -z "\$FAULT"); then make || FAULT=1 ; fi - # Clean to avoid to rsync back the files - cargo clean + while IFS= read -r bin;do + "\${bin}" || FAULT=1 + done < ./tests.sh if (test -n "\$FAULT"); then exit 1 ; fi EOF diff --git a/tests/by-util/test_id.rs b/tests/by-util/test_id.rs index 30e4c1ac9a0..e4eec6d4f97 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -152,6 +152,10 @@ fn test_id_real() { } #[test] +#[cfg_attr( + target_os = "freebsd", + ignore = "" +)] fn test_id_groups_ordering() { // `groups=` is headed by the effective gid and `-G` by the real gid, so the // two forms list the same set in a different order. Only observable when the