Repository navigation
openbsd.yml: speedup tests #16340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+89
−81
Merged
openbsd.yml: speedup tests #16340
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| name: OpenBSD | ||
|
|
||
| # spell-checker:ignore sshfs usesh vmactions taiki esac fdescfs fdesc nextest copyback logind | ||
| # spell-checker:ignore sshfs usesh vmactions taiki esac fdescfs fdesc mlugg copyback logind zigbuild | ||
|
|
||
| env: | ||
| FEATURES: "feat_Tier1,feat_require_unix" | ||
| # * 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" | ||
| RUSTFLAGS: "-C strip=symbols" # Avoid filling disk space | ||
| RUST_BACKTRACE: "1" | ||
| RUSTC_BOOTSTRAP: "1" # use build-std | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
@@ -22,11 +24,14 @@ | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
| style: | ||
| name: Style and Lint | ||
| clippy_test_zig: | ||
| name: clippy and test | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| 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,9 +51,6 @@ | |
| - uses: mlugg/setup-zig@v2.2.1 | ||
| - uses: taiki-e/install-action@cargo-zigbuild | ||
| - name: cargo clippy | ||
| env: | ||
| CARGO_INCREMENTAL: "0" | ||
| RUSTC_BOOTSTRAP: "1" | ||
| run: | | ||
| # Set linker for stdbuf. env: and -Z do not work. Override `config.toml` to avoid duplicated keys. | ||
| # We don't use `aws-lc` at here. | ||
|
|
@@ -60,49 +62,82 @@ | |
| EOF | ||
| UTILS=$(cargo tree --depth 1 --features ${{ env.FEATURES }} --format '{lib}' --prefix none | sed -n 's/^uu_/-p uu_/p') | ||
| cargo-zigbuild clippy --target x86_64-unknown-openbsd --features ${{ env.FEATURES }} -p coreutils ${UTILS} --all-targets --tests --benches -- -D warnings | ||
| - name: prepare testing | ||
| run: | | ||
| cargo-zigbuild test --target x86_64-unknown-openbsd --no-run --features ${{ env.FEATURES }} --message-format=json \ | ||
| | jq -rs ' | ||
| [ .[] | select(.executable != null) | .executable | select(test("/coreutils$") | not) ] | ||
| | unique | ||
| | .[] | ||
| ' > tests.sh | ||
| - name: test | ||
| uses: vmactions/openbsd-vm@v1 | ||
| with: | ||
|
oech3 marked this conversation as resolved.
Resolved
|
||
| usesh: true | ||
| sync: rsync | ||
| copyback: false | ||
| mem: 6144 | ||
| prepare: pkg_add sudo-- | ||
| run: | | ||
| ## test | ||
| set -e | ||
| # | ||
| TEST_USER=tester | ||
| REPO_NAME=${GITHUB_WORKSPACE##*/} | ||
| WORKSPACE_PARENT="/home/runner/work/${REPO_NAME}" | ||
| WORKSPACE="${WORKSPACE_PARENT}/${REPO_NAME}" | ||
| # | ||
| useradd -m -G wheel ${TEST_USER} | ||
| chown -R ${TEST_USER}:wheel /root/ "${WORKSPACE_PARENT}"/ | ||
| whoami | ||
| # Add fake host for reverse DNS lookup (needed for hostname test) | ||
| printf "10.0.2.15\topenbsd.my.domain openbsd\n" >> /etc/hosts | ||
| # | ||
| # Further work needs to be done in a sudo as we are changing users | ||
| sudo -i -u ${TEST_USER} sh << EOF | ||
| set -e | ||
| whoami | ||
| # Increase max open files (512 by default) | ||
| ulimit -n 1024 | ||
| ## Info | ||
|
oech3 marked this conversation as resolved.
Resolved
|
||
| 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-openbsd/debug/coreutils /tmp/coreutils | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why copy it to /tmp instead of pointing UUTESTS_BINARY_PATH at target/ directly?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. direct path did not work. |
||
| export UUTESTS_BINARY_PATH=/tmp/coreutils | ||
| while IFS= read -r bin;do | ||
| "\${bin}" || FAULT=1 # todo: retry tests (should we nextest on the VM if it failed?) | ||
| 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: 60 | ||
| steps: | ||
| - uses: actions/checkout@v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Avoid no space left on device # shared with guest? | ||
| shell: bash | ||
| run: | | ||
| mkdir /tmp/empty | ||
| sudo rsync -a --delete /tmp/empty/ /usr/lib/jvm/ | ||
| sudo rsync -a --delete /tmp/empty/ /usr/share/dotnet/ | ||
| sudo rsync -a --delete /tmp/empty/ /usr/local/lib/android/ | ||
| - name: Prepare, build and test | ||
| - name: test | ||
| uses: vmactions/openbsd-vm@v1 | ||
| with: | ||
| usesh: true | ||
| sync: rsync | ||
| copyback: false | ||
| mem: 6144 | ||
|
oech3 marked this conversation as resolved.
Resolved
|
||
| # Install rust and build dependencies | ||
| prepare: | | ||
| # Clean up disk space before installing packages | ||
| df -h | ||
| mkdir -p empty | ||
| rsync -a --delete empty/ /usr/share/relink/ | ||
| rsync -a --delete empty/ /usr/X11R6/ | ||
| rsync -a --delete empty/ /usr/share/doc/ | ||
| rsync -a --delete empty/ /usr/share/man/ | ||
| pkg_add curl gmake sudo-- rust | ||
| # Clean up package cache after installation | ||
| pkg_delete -a | ||
| df -h | ||
| prepare: pkg_add gmake sudo-- rust | ||
| run: | | ||
| ## Prepare, build, and test | ||
| # implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783> | ||
| # * NOTE: All steps need to be run in this block, otherwise, we are operating back on the mac host | ||
| ## test | ||
| set -e | ||
| # | ||
| export CARGO_INCREMENTAL=0 | ||
| TEST_USER=tester | ||
| REPO_NAME=${GITHUB_WORKSPACE##*/} | ||
| WORKSPACE_PARENT="/home/runner/work/${REPO_NAME}" | ||
|
|
@@ -120,52 +155,23 @@ | |
| whoami | ||
| # Increase max open files (512 by default) | ||
| ulimit -n 1024 | ||
| # todo: install nextest if official OpenBSD package was provided | ||
| # Use regular cargo test currently | ||
| ## Info | ||
| echo "::group::environment" | ||
| echo "CI='${CI}'" | ||
| echo "REPO_NAME='${REPO_NAME}'" | ||
| echo "TEST_USER='${TEST_USER}'" | ||
| echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'" | ||
| echo "WORKSPACE='${WORKSPACE}'" | ||
| env | sort | ||
| echo "::endgroup::" | ||
| echo "::group::tooling info" | ||
| cargo -V | ||
| rustc -V | ||
| echo "::endgroup::" | ||
| # | ||
| # To ensure that files are cleaned up, we don't want to exit on error | ||
| set +e | ||
| cd "${WORKSPACE}" | ||
| unset FAULT | ||
| # openbsd is very slow. Omit duplicated cargo build and do test only | ||
| export RUST_BACKTRACE=1 | ||
| export CARGO_TERM_COLOR=always | ||
| # Avoid filling disk space | ||
| export RUSTFLAGS="-C strip=symbols" | ||
| # vendored OpenSSL takes many times to build. Use system one (LibreSSL is supported). | ||
| export OPENSSL_NO_VENDOR=1 OPENSSL_DIR=/usr | ||
| # Use cargo test since nextest might not support OpenBSD | ||
| if (test -z "\$FAULT"); then | ||
| echo "::group::cargo test (workspace)" | ||
| cargo test --features ${{ env.FEATURES }} || FAULT=1 | ||
| echo "::endgroup::" | ||
| fi | ||
| if (test -z "\$FAULT"); then | ||
| echo "::group::cargo test (uucore)" | ||
| cargo test --all-features -p uucore || FAULT=1 | ||
| echo "::endgroup::" | ||
| fi | ||
| # Test building with make | ||
| if (test -z "\$FAULT"); then | ||
| echo "::group::make MULTICALL=Y" | ||
| make MULTICALL=Y || FAULT=1 | ||
| echo "::endgroup::" | ||
| fi | ||
| # Clean to avoid to rsync back the files and free up disk space | ||
| cargo clean | ||
| # Additional cleanup to free disk space | ||
| export RUSTFLAGS="-C strip=symbols" # Avoid filling disk space | ||
| # GNUmakefile and LibreSSL cannot be covered by zig | ||
| # `--all-features` pulls `openssl` feature of uucore | ||
| export OPENSSL_NO_VENDOR=1 OPENSSL_STATIC=0 OPENSSL_DIR=/usr | ||
| cargo test --all-features -p uucore || FAULT=1 | ||
| export CARGOFLAGS="--features=openssl" | ||
| make test MULTICALL=y UTILS=cksum || FAULT=1 | ||
| if (test -n "\$FAULT"); then exit 1 ; fi | ||
| EOF | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with clippy and tests in the same job, a clippy warning now skips all the tests, is it intended?
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to continue
cargo testwhenclippyfailed (and setFAULT=1)? I think it just eats CI.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On
freebsd.yml, separatingclippyincreases build time 30 sec+.openbsd.ymlwould increase much more due tobuild-std.