Skip to content

Commit

Permalink
fixing merge_profdata.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmncos committed Aug 19, 2024
1 parent 15d6ee4 commit 9937bf1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/coverage-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ jobs:
- name: Build examples
env:
RUSTFLAGS: '-C link-arg=-s'
run: cd ./examples && ./build_wasm_test_all.sh
run: cd ./examples && ./build_wasm_test_all.sh
- name: Merge profdata files
env:
RUSTFLAGS: '-C link-arg=-s'
run: cd ./examples && ./merge_profdata.sh
18 changes: 0 additions & 18 deletions examples/build_wasm_test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,6 @@ for d in "status-message" $(ls -d */ | grep -v -e "status-message\/$"); do
fi
done

echo "Merging .profraw files"
cargo wasmcov merge

cd $WASMCOV_DIR
mkdir lcov

for file in "$WASMCOV_DIR"/profdata/*.profdata; do
profdata_file_name=$(basename "$file")
# replacing '-' by '_' and changing extension .profdata by .o
object_file_name=$(echo "$base_name" | sed 's/-/_/g' | sed 's/.profdata$/.o/')

lcov_file_name=$(echo "$base_name" | sed 's/-/_/g' | sed 's/.profdata$/.lcov/')

echo "Base profdata: $profdata_file_name"
echo "Object file name: $object_file_name"
echo "Lcov file name: $lcov_file_name"

llvm-cov export --instr-profile= "$WASMCOV_DIR/profdata/$profdata_file_name" "$WASMCOV_DIR/target/$object_file_name" > "$WASMCOV_DIR/lcov/$lcov_file_name"
done


25 changes: 25 additions & 0 deletions examples/merge_profdata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

echo "Merging .profraw files"

cargo wasmcov merge
cd $WASMCOV_DIR
mkdir lcov
ls profdata

for file in "$WASMCOV_DIR"/profdata/*.profdata; do
profdata_file_name=$(basename "$file")
# replacing '-' by '_' and changing extension .profdata by .o
object_file_name=$(echo "$profdata_file_name" | sed 's/-/_/g' | sed 's/.profdata$/.o/')

lcov_file_name=$(echo "$profdata_file_name" | sed 's/-/_/g' | sed 's/.profdata$/.lcov/')

echo "Base profdata: $profdata_file_name"
echo "Object file name: $object_file_name"
echo "Lcov file name: $lcov_file_name"
echo "$WASMCOV_DIR/profdata/$profdata_file_name"
echo "$WASMCOV_DIR/target/$object_file_name"
echo "$WASMCOV_DIR/lcov/$lcov_file_name"
echo "------------"
llvm-cov export --instr-profile="$WASMCOV_DIR/profdata/$profdata_file_name" "$WASMCOV_DIR/target/$object_file_name" > "$WASMCOV_DIR/lcov/$lcov_file_name"
done

0 comments on commit 9937bf1

Please sign in to comment.