diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 3d1a4fd1f70..c88b781bd81 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,11 +21,14 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - style: - name: Style and Lint + style_test_zig: + name: clippy and 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 @@ -46,26 +49,75 @@ jobs: - uses: mlugg/setup-zig@v2.2.1 - uses: taiki-e/install-action@cargo-zigbuild - name: cargo clippy - env: - CARGO_INCREMENTAL: "0" 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 + - name: prepare testing + run: | + # system openssl feature is covered on VM + cargo-zigbuild test --target x86_64-unknown-freebsd --no-run --features feat_os_unix --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 sudo + run: | + ## test + set -e + # + # We need a file-descriptor file system to test test_ls::test_ls_io_errors + mount -t fdescfs fdesc /dev/fd + # + TEST_USER=tester + REPO_NAME=${GITHUB_WORKSPACE##*/} + WORKSPACE_PARENT="/home/runner/work/${REPO_NAME}" + WORKSPACE="${WORKSPACE_PARENT}/${REPO_NAME}" + # + pw adduser -n ${TEST_USER} -d /root/ -g wheel -c "Coreutils user to build" -w random + chown -R ${TEST_USER}:wheel /root/ "${WORKSPACE_PARENT}"/ + whoami + # + # Further work needs to be done in a sudo as we are changing users + sudo -i -u ${TEST_USER} sh << EOF + set -e + whoami + ## Info + # environment + echo "## environment" + echo "CI='${CI}'" + echo "REPO_NAME='${REPO_NAME}'" + echo "TEST_USER='${TEST_USER}'" + echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'" + echo "WORKSPACE='${WORKSPACE}'" + env | sort + set +e + cd "${WORKSPACE}" + unset FAULT + cp -v target/x86_64-unknown-freebsd/debug/coreutils /tmp/coreutils + export UUTESTS_BINARY_PATH=/tmp/coreutils + while IFS= read -r bin;do + "\${bin}" || FAULT=1 + done < ./tests.sh + if (test -n "\$FAULT"); then exit 1 ; fi + EOF - test: - name: Tests + uucore_openssl: + name: uucore and openssl 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 + - name: test uses: vmactions/freebsd-vm@v1.6.0 with: usesh: true @@ -73,12 +125,9 @@ jobs: copyback: false prepare: pkg install -y gmake nextest rust 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 mount -t fdescfs fdesc /dev/fd # TEST_USER=tester @@ -113,19 +162,12 @@ jobs: 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} + export CARGO_INCREMENTAL=0 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 + # GNUmakefile and OpenSSL cannot be covered by zig + export OPENSSL_NO_VENDOR=1 OPENSSL_DIR=/usr 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 + if (test -z "\$FAULT"); then make nextest MULTICALL=y UTILS=cksum || FAULT=1 ; fi 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..abf2fdabb0a 100644 --- a/tests/by-util/test_id.rs +++ b/tests/by-util/test_id.rs @@ -152,6 +152,7 @@ fn test_id_real() { } #[test] +#[cfg_attr(target_os = "freebsd", ignore = "should dedup same id's ")] 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