Skip to content

Commit 32d8bf1

Browse files
committed
ci: use -Cprofile-generate instead of -Zprofile
Support for -Zprofile has been removed in rust-lang/rust#131829
1 parent 17fee51 commit 32d8bf1

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/CICD.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ jobs:
945945
- uses: dtolnay/rust-toolchain@master
946946
with:
947947
toolchain: ${{ matrix.job.toolchain }}
948-
components: rustfmt
948+
components: rustfmt, llvm-tools-preview
949949
- uses: taiki-e/install-action@nextest
950950
- uses: taiki-e/install-action@grcov
951951
- uses: Swatinem/rust-cache@v2
@@ -1000,6 +1000,7 @@ jobs:
10001000
# Update binutils if MinGW due to https://github.com/rust-lang/rust/issues/112368
10011001
windows-latest) C:/msys64/usr/bin/pacman.exe -Sy --needed mingw-w64-x86_64-gcc --noconfirm ; echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH ;;
10021002
esac
1003+
mkdir -p ${{ vars.RUNNER_TEMP }}/target/debug
10031004
- name: Initialize toolchain-dependent workflow variables
10041005
id: dep_vars
10051006
shell: bash
@@ -1014,17 +1015,19 @@ jobs:
10141015
run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
10151016
env:
10161017
RUSTC_WRAPPER: ""
1017-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
1018+
RUSTFLAGS: "-Cprofile-generate=${{ vars.RUNNER_TEMP }}/target/debug -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
10181019
RUSTDOCFLAGS: "-Cpanic=abort"
10191020
RUST_BACKTRACE: "1"
1021+
LLVM_PROFILE_FILE: "coreutils-%p-%m.profraw"
10201022
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
10211023
- name: Test individual utilities
10221024
run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
10231025
env:
10241026
RUSTC_WRAPPER: ""
1025-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
1027+
RUSTFLAGS: "-Cprofile-generate=${{ vars.RUNNER_TEMP }}/target/debug -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
10261028
RUSTDOCFLAGS: "-Cpanic=abort"
10271029
RUST_BACKTRACE: "1"
1030+
LLVM_PROFILE_FILE: "coreutils-%p-%m.profraw"
10281031
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
10291032
- name: Generate coverage data (via `grcov`)
10301033
id: coverage
@@ -1037,9 +1040,9 @@ jobs:
10371040
# GRCOV_EXCLUDE_OPTION='--excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"' ## `grcov` ignores these params when passed as an environment variable (why?)
10381041
mkdir -p "${COVERAGE_REPORT_DIR}"
10391042
# display coverage files
1040-
grcov . --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
1043+
grcov . --binary-path="${COVERAGE_REPORT_DIR}" --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
10411044
# generate coverage report
1042-
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
1045+
grcov . --binary-path="${COVERAGE_REPORT_DIR}" --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
10431046
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
10441047
- name: Upload coverage results (to Codecov.io)
10451048
uses: codecov/codecov-action@v4

.github/workflows/GnuTests.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,16 @@ jobs:
383383
locale -a
384384
- name: Build binaries
385385
env:
386-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
386+
RUSTFLAGS: "-Cprofile-generate=uutils/target/debug -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
387387
RUSTDOCFLAGS: "-Cpanic=abort"
388388
run: |
389389
## Build binaries
390390
cd uutils
391391
bash util/build-gnu.sh
392392
- name: Run GNU tests
393393
run: bash uutils/util/run-gnu-test.sh
394+
- name: Install llvm-tools-preview
395+
run: rustup component add llvm-tools-preview
394396
- name: Generate coverage data (via `grcov`)
395397
id: coverage
396398
run: |
@@ -401,9 +403,9 @@ jobs:
401403
mkdir -p "${COVERAGE_REPORT_DIR}"
402404
sudo chown -R "$(whoami)" "${COVERAGE_REPORT_DIR}"
403405
# display coverage files
404-
grcov . --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
406+
grcov . --binary-path="${COVERAGE_REPORT_DIR}" --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
405407
# generate coverage report
406-
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
408+
grcov . --binary-path="{COVERAGE_REPORT_DIR}" --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
407409
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
408410
- name: Upload coverage results (to Codecov.io)
409411
uses: codecov/codecov-action@v4

0 commit comments

Comments
 (0)