Skip to content

Commit

Permalink
ci: verify reset buttons are working
Browse files Browse the repository at this point in the history
  • Loading branch information
whentojump committed Jul 3, 2024
1 parent 37f692d commit b1c04c2
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/llvm-19-patch-v0.6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,9 @@ 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
run: cat $MCDC_HOME/analysis/text-coverage-reports/index.txt
74 changes: 74 additions & 0 deletions ci/5_boot_kernel_and_collect_coverage.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,79 @@
#!/bin/bash

#
# Test the functionality of cnts_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; 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_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

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

#
# Actual coverage of KUnit + boot
#

GUEST_COMMANDS="true"
GUEST_COMMANDS="$GUEST_COMMANDS; uname -a"
GUEST_COMMANDS="$GUEST_COMMANDS; ls /sys/kernel/debug/llvm-cov"
Expand Down

0 comments on commit b1c04c2

Please sign in to comment.