Skip to content

Commit 4529003

Browse files
committed
ci: use -Cprofile-generate instead of -Zprofile
Support for -Zprofile has been removed in rust-lang/rust#131829
1 parent 80f0a28 commit 4529003

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

.github/workflows/CICD.yml

Lines changed: 7 additions & 5 deletions
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
@@ -1014,17 +1014,19 @@ jobs:
10141014
run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
10151015
env:
10161016
RUSTC_WRAPPER: ""
1017-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
1017+
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"
10181018
RUSTDOCFLAGS: "-Cpanic=abort"
10191019
RUST_BACKTRACE: "1"
1020+
LLVM_PROFILE_FILE: "coreutils-%p-%m.profraw"
10201021
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
10211022
- name: Test individual utilities
10221023
run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
10231024
env:
10241025
RUSTC_WRAPPER: ""
1025-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
1026+
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"
10261027
RUSTDOCFLAGS: "-Cpanic=abort"
10271028
RUST_BACKTRACE: "1"
1029+
LLVM_PROFILE_FILE: "coreutils-%p-%m.profraw"
10281030
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
10291031
- name: Generate coverage data (via `grcov`)
10301032
id: coverage
@@ -1037,9 +1039,9 @@ jobs:
10371039
# GRCOV_EXCLUDE_OPTION='--excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"' ## `grcov` ignores these params when passed as an environment variable (why?)
10381040
mkdir -p "${COVERAGE_REPORT_DIR}"
10391041
# 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
1042+
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
10411043
# 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\()"
1044+
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\()"
10431045
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
10441046
- name: Upload coverage results (to Codecov.io)
10451047
uses: codecov/codecov-action@v4

.github/workflows/GnuTests.yml

Lines changed: 5 additions & 3 deletions
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)