kcov: Filter out generated files, rename var

This commit is contained in:
wtfsck 2021-10-13 19:20:41 +02:00
parent fa50ba1a11
commit 54ba065ea8
1 changed files with 12 additions and 11 deletions

View File

@ -17,7 +17,7 @@ test_features=y
test_current=y
test_msrv=y
test_code_asm=y
test_cov=n
gen_cov=n
kcov=kcov
cov_out=$root_dir/cov-out
@ -51,7 +51,7 @@ test_valid_invalid_instructions() {
# The C# code needs a formatter so add masm feature
dotnet build -c:$configuration -p:IcedFeatureFlags="DECODER ENCODER OPCODE_INFO INSTR_INFO MASM" "$root_dir/src/csharp/Intel/IcedFuzzer/IcedFuzzer/IcedFuzzer.csproj"
if [ "$test_cov" = "y" ]; then
if [ "$gen_cov" = "y" ]; then
release_flag=
fzgt_output_dir=debug
else
@ -183,8 +183,9 @@ build_features() {
cov_test() {
cov_test_dir=$1
shift
if [ "$test_cov" = "y" ]; then
$kcov --verify --exclude-pattern=/tests/,/test/,/test_utils/ --include-pattern=/iced-x86/ "$cov_out_rust_tmp/$cov_test_dir" "$@"
if [ "$gen_cov" = "y" ]; then
# Don't include: tests, big generated files
"$kcov" --verify --exclude-pattern=/tests/,/test/,/test_utils/,fn_asm_impl.rs,fn_asm_pub.rs --include-pattern=/iced-x86/ "$cov_out_rust_tmp/$cov_test_dir" "$@"
else
"$@"
fi
@ -193,7 +194,7 @@ cov_test() {
cargo_test_cov() {
cov_test_dir=$1
shift
if [ "$test_cov" = "y" ]; then
if [ "$gen_cov" = "y" ]; then
test_exe=$(cargo test --color always --no-run --message-format=json "$@" | grep -- '"name":"iced-x86"' | tail -1 | sed -e 's/.*"executable":"\([^"]\+\)".*/\1/')
if [ ! -x "$test_exe" ]; then
echo "Couldn't get the test executable name, got '$test_exe'"
@ -312,7 +313,7 @@ while [ "$#" -gt 0 ]; do
--test-features) test_features=y ;;
--test-current) test_current=y ;;
--test-msrv) test_msrv=y ;;
--coverage) test_cov=y ;;
--coverage) gen_cov=y ;;
--no-set-rustflags) set_rustflags=n ;;
*) echo "Unknown arg: $1"; exit 1 ;;
@ -333,11 +334,11 @@ fi
echo "rustup show"
rustup show
if [ "$test_cov" = "y" ]; then
if [ "$gen_cov" = "y" ]; then
mkdir -p "$cov_out"
rm -rf "$cov_out_rust" "$cov_out_rust_merged"
rm -rf "$cov_out_rust"
mkdir -p "$cov_out_rust_tmp"
$kcov --version
"$kcov" --version
fi
if [ "$test_code_asm" = "y" ]; then
@ -370,6 +371,6 @@ if [ "$test_msrv" = "y" ]; then
build_test_msrv
fi
if [ "$test_cov" = "y" ]; then
$kcov --merge "$cov_out_rust_merged" "$cov_out_rust_tmp/"*
if [ "$gen_cov" = "y" ]; then
"$kcov" --merge "$cov_out_rust_merged" "$cov_out_rust_tmp/"*
fi