Skip to content

Commit

Permalink
nightly advanced infos
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Nov 12, 2024
1 parent 1e41722 commit 2df29ea
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
39 changes: 25 additions & 14 deletions .github/workflows/cargo_llvm_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:

- name: Install llvm-tools
run: |
TOOLCHAIN=$(rustup show active-toolchain | cut -d ' ' -f 1)
# TOOLCHAIN=$(rustup show active-toolchain | cut -d ' ' -f 1)
TOOLCHAIN=nightly
rustup component add llvm-tools --toolchain "$TOOLCHAIN"
LLVM_PROFDATA=$HOME/.rustup/toolchains/$TOOLCHAIN/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata
echo "LLVM_PROFDATA=$LLVM_PROFDATA" >> $GITHUB_ENV
Expand All @@ -58,13 +59,14 @@ jobs:
exit 1
fi
- name: Compute code coverage and create report (nextest.info)
- name: Compute code coverage (nextest.profdata)
run: |
cargo llvm-cov clean --profraw-only
cargo +nightly llvm-cov clean --profraw-only
echo "Computing nextest code coverage."
set +e
IOTA_SKIP_SIMTESTS=1 cargo llvm-cov \
IOTA_SKIP_SIMTESTS=1 cargo +nightly llvm-cov \
--branch \
--ignore-run-fail \
--no-report \
nextest -vv
Expand All @@ -80,40 +82,49 @@ jobs:
find target/llvm-cov-target -name '*.profraw' -print0 | xargs -0 $LLVM_PROFDATA merge --failure-mode=warn --sparse --output target/nextest.profdata
[ -f "target/nextest.profdata" ] || exit 1
# - name: Compute code coverage and create report (simtest.info)
# - name: Compute code coverage (simtest.profdata)
# run: |
# cargo llvm-cov clean --profraw-only
# cargo +nightly llvm-cov clean --profraw-only

# git clean -fd
# set +e
# ./scripts/simtest/simtest-cov.sh
# # For now we accept failing simtest coverage
# # [ -f "target/simtest.info" ] || exit 1
# if [ ! -f "target/simtest.info" ]; then
# echo "Error: failed to create simtest report."
# # [ -f "target/simtest.profdata" ] || exit 1
# if [ ! -f "target/simtest.profdata" ]; then
# echo "Error: failed to create simtest.profdata."
# fi
# exit 0

- name: Create html report (report.tgz)
run: |
cd target || exit 1
cd target
if [ -d "report" ]; then
echo "Cleaning up."
echo "Cleaning old report."
rm -rf report
fi
echo "Creating html report."
if [ -f "simtest.profdata" ]; then
$LLVM_PROFDATA merge --failure-mode=warn --sparse nextest.profdata simtest.profdata --output merged.profdata
else
$LLVM_PROFDATA merge --failure-mode=warn --sparse nextest.profdata --output merged.profdata
mv nextest.profdata merged.profdata
fi
[ -f "merged.profdata" ] || exit 1
LLVM_PROFILE_FILE="merged.profdata" cargo llvm-cov report \
LLVM_PROFILE_FILE="merged.profdata" cargo +nightly llvm-cov report \
--html \
--output-dir report \
--show-instantiations \
--show-missing-lines \
--doctests \
--output-dir . \
--ignore-filename-regex 'external-crates/.*'
[ -d "html" ] || exit 1
mv html report
echo "Packaging html report."
[ -d "report" ] || exit 1
tar -czf report.tgz report
Expand Down
10 changes: 4 additions & 6 deletions scripts/simtest/simtest-cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ git apply ./scripts/simtest/config-patch
root_dir=$(git rev-parse --show-toplevel)
export SIMTEST_STATIC_INIT_MOVE=$root_dir"/examples/move/basics"

TOOLCHAIN=$(rustup show active-toolchain | cut -d ' ' -f 1)
#TOOLCHAIN=$(rustup show active-toolchain | cut -d ' ' -f 1)
TOOLCHAIN=nightly
LLVM_PROFDATA="$HOME/.rustup/toolchains/$TOOLCHAIN/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata"

echo "Computing simtest code coverage."
MSIM_WATCHDOG_TIMEOUT_MS=60000 MSIM_TEST_SEED=1 cargo llvm-cov \
--branch \
--ignore-run-fail \
--no-report \
nextest -vv # --cargo-profile simulator
Expand All @@ -33,11 +35,7 @@ find target/llvm-cov-target -name '*.profraw' | while read file; do
fi
done

echo "Creating simtest report."
cargo llvm-cov report \
--lcov \
--output-path target/simtest.info \
--ignore-filename-regex 'external-crates/.*'
find target/llvm-cov-target -name '*.profraw' -print0 | xargs -0 $LLVM_PROFDATA merge --failure-mode=warn --sparse --output target/simtest.profdata

# remove the patch
git checkout .cargo/config Cargo.toml Cargo.lock

0 comments on commit 2df29ea

Please sign in to comment.