Skip to content

Commit

Permalink
Merge pull request #4251 from Joining7943/ci-run-tests-with-backtrace
Browse files Browse the repository at this point in the history
`ci/tests`: Run cargo test with RUST_BACKTRACE=1
  • Loading branch information
sylvestre authored Jan 2, 2023
2 parents 75cf8ce + ccfc799 commit c2e4da9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ jobs:
run: cargo test -v ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
env:
RUSTFLAGS: "-Awarnings --cfg unsound_local_offset"
RUST_BACKTRACE: "1"

deps:
name: Dependencies
Expand Down Expand Up @@ -394,6 +395,8 @@ jobs:
shell: bash
run: |
make test
env:
RUST_BACKTRACE: "1"


build_rust_stable:
Expand All @@ -417,6 +420,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Test
run: cargo test ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
env:
RUST_BACKTRACE: "1"

build_rust_nightly:
name: Build/nightly
Expand All @@ -439,6 +444,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Test
run: cargo test ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
env:
RUST_BACKTRACE: "1"

compute_size:
name: Binary sizes
Expand Down Expand Up @@ -597,7 +604,7 @@ jobs:
# ** pass needed environment into `cross` container (iff `cross` not already configured via "Cross.toml")
if [ "${CARGO_CMD}" = 'cross' ] && [ ! -e "Cross.toml" ] ; then
cargo install --version 0.2.1 cross
printf "[build.env]\npassthrough = [\"CI\"]\n" > Cross.toml
printf "[build.env]\npassthrough = [\"CI\", \"RUST_BACKTRACE\"]\n" > Cross.toml
fi
# * test only library and/or binaries for arm-type targets
unset CARGO_TEST_OPTIONS ; case '${{ matrix.job.target }}' in aarch64-* | arm-*) CARGO_TEST_OPTIONS="--bins" ;; esac;
Expand Down Expand Up @@ -694,11 +701,15 @@ jobs:
run: |
${{ steps.vars.outputs.CARGO_CMD }} +${{ env.RUST_MIN_SRV }} test --target=${{ matrix.job.target }} \
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
env:
RUST_BACKTRACE: "1"
- name: Test individual utilities
shell: bash
run: |
${{ steps.vars.outputs.CARGO_CMD }} +${{ env.RUST_MIN_SRV }} test --target=${{ matrix.job.target }} \
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
env:
RUST_BACKTRACE: "1"
- name: Archive executable artifacts
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -1023,6 +1034,7 @@ jobs:
cd "${WORKSPACE}"
unset FAULT
cargo build || FAULT=1
export RUST_BACKTRACE=1
if (test -z "\$FAULT"); then cargo test --features '${{ matrix.job.features }}' || FAULT=1 ; fi
if (test -z "\$FAULT"); then cargo test --all-features -p uucore || FAULT=1 ; fi
# Clean to avoid to rsync back the files
Expand Down Expand Up @@ -1113,6 +1125,7 @@ jobs:
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
RUST_BACKTRACE: "1"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: Test
run: cargo test ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-fail-fast
Expand All @@ -1121,6 +1134,7 @@ jobs:
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
RUST_BACKTRACE: "1"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: Test individual utilities
run: cargo test --no-fail-fast ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
Expand All @@ -1129,6 +1143,7 @@ jobs:
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
RUST_BACKTRACE: "1"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: "`grcov` ~ install"
id: build_grcov
Expand Down
1 change: 1 addition & 0 deletions util/android-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ build () {

tests () {
probe='/sdcard/tests.probe'
export RUST_BACKTRACE=1
command="'cd ~/coreutils && timeout --preserve-status --verbose -k 1m 60m cargo test --features feat_os_unix_android --no-fail-fast >/sdcard/tests.log 2>&1; echo \$? >$probe'"
run_termux_command "$command" "$probe"
return_code=$?
Expand Down

0 comments on commit c2e4da9

Please sign in to comment.