Skip to content

Commit

Permalink
all: revert to one reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
whentojump committed Aug 13, 2024
1 parent 54e40bc commit 741c9a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 47 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/llvm-trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ jobs:
llc --version
- name: Boot the kernel and collect coverage
run: ./ci/5_boot_kernel_and_collect_coverage.sh
- name: Print the index of coverage report (immediately after counter reset)
run: cat $MCDC_HOME/analysis_cnts_reset/text-coverage-reports/index.txt
- name: Print the index of coverage report (immediately after bitmap reset)
run: cat $MCDC_HOME/analysis_bits_reset/text-coverage-reports/index.txt
- name: Print the index of coverage report (immediately after reset)
run: cat $MCDC_HOME/analysis_reset/text-coverage-reports/index.txt
- name: Print the index of coverage report
run: cat $MCDC_HOME/analysis/text-coverage-reports/index.txt
45 changes: 5 additions & 40 deletions ci/5_boot_kernel_and_collect_coverage.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

#
# Test the functionality of cnts_reset
# Test the functionality of reset
#

GUEST_COMMANDS="true"
GUEST_COMMANDS="$GUEST_COMMANDS; uname -a"
GUEST_COMMANDS="$GUEST_COMMANDS; ls /sys/kernel/debug/llvm-cov"
GUEST_COMMANDS="$GUEST_COMMANDS; echo 1 > /sys/kernel/debug/llvm-cov/cnts_reset"
GUEST_COMMANDS="$GUEST_COMMANDS; echo 1 > /sys/kernel/debug/llvm-cov/reset"
GUEST_COMMANDS="$GUEST_COMMANDS; cp /sys/kernel/debug/llvm-cov/profraw ."

cd $MCDC_HOME/linux
Expand All @@ -19,44 +19,9 @@ if ! grep "LLVM raw profile data, version 10" /tmp/file.log > /dev/null; then
exit 1
fi

mkdir -p $MCDC_HOME/analysis_cnts_reset
mv profraw $MCDC_HOME/analysis_cnts_reset
cd $MCDC_HOME/analysis_cnts_reset

llvm-profdata merge profraw -o profdata
llvm-cov show --show-mcdc \
--show-mcdc-summary \
--show-region-summary=false \
--show-branch-summary=false \
--format=text \
-use-color \
-show-directory-coverage \
-output-dir=text-coverage-reports \
-instr-profile profdata \
$MCDC_HOME/linux/vmlinux

#
# Test the functionality of bits_reset
#

GUEST_COMMANDS="true"
GUEST_COMMANDS="$GUEST_COMMANDS; uname -a"
GUEST_COMMANDS="$GUEST_COMMANDS; ls /sys/kernel/debug/llvm-cov"
GUEST_COMMANDS="$GUEST_COMMANDS; echo 1 > /sys/kernel/debug/llvm-cov/bits_reset"
GUEST_COMMANDS="$GUEST_COMMANDS; cp /sys/kernel/debug/llvm-cov/profraw ."

cd $MCDC_HOME/linux
$MCDC_HOME/linux-mcdc/scripts/q -c "$GUEST_COMMANDS"

file profraw |& tee /tmp/file.log
if ! grep "LLVM raw profile data, version 10" /tmp/file.log > /dev/null; then
printf "\nUnexpected profraw\n"
exit 1
fi

mkdir -p $MCDC_HOME/analysis_bits_reset
mv profraw $MCDC_HOME/analysis_bits_reset
cd $MCDC_HOME/analysis_bits_reset
mkdir -p $MCDC_HOME/analysis_reset
mv profraw $MCDC_HOME/analysis_reset
cd $MCDC_HOME/analysis_reset

llvm-profdata merge profraw -o profdata
llvm-cov show --show-mcdc \
Expand Down
5 changes: 2 additions & 3 deletions docs/measure-kernel-mcdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,9 @@ Let's inspect the directory added to debugfs by our patch:
ls /sys/kernel/debug/llvm-cov
```

which should contain three pseudo files: `profraw`, `cnts_reset` and `bits_reset`.
which should contain two pseudo files: `profraw` and `reset`.

- Writing to `cnts_reset` will clear the in-memory counters
- Writing to `bits_reset` will clear the in-memory bitmaps
- Writing to `reset` will clear the in-memory counters and bitmaps.
- Reading `profraw` will serialize the in-memory counters and bitmaps in a
[proper format](https://llvm.org/docs/InstrProfileFormat.html)
<!-- The essential difference between LLVM 18 and >= 19 is this format. Since
Expand Down

0 comments on commit 741c9a0

Please sign in to comment.