Skip to content

Commit

Permalink
Infra: Fix jvm coverage report
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <[email protected]>
  • Loading branch information
arthurscchan committed Nov 6, 2024
1 parent edfa673 commit 5f896ed
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions infra/base-images/base-runner/coverage
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,18 @@ elif [[ $FUZZING_LANGUAGE == "jvm" ]]; then
then
tempdir=$(mktemp -d)
cd $tempdir && jar xvf $jar_file && cd -

# Remove class files that are not compiled from the java files found in $OUT/$SRC before copying
find $tempdir -type f -name "*.class" | while read -r class_file; do
relative_path=${class_file#$tempdir/}
java_file_name=${relative_path%.class}.java
if ! find $OUT$SRC -type f -name $(basename $java_file_name) | grep -q $java_file_name
then
echo "Removing: $class_file"
rm -f "$class_file"
fi
done

cp -r $tempdir/* $classes_dir/
rm -r $tempdir
fi
Expand All @@ -473,6 +485,8 @@ elif [[ $FUZZING_LANGUAGE == "jvm" ]]; then
# Remove all class files which have a dot in their file name which are normally
# used to name a duplication of the legitimate class file.
find $classes_dir/*/ -type f -name "*.*.class" | xargs rm -f
# Clean up empty package directories
# find $classes_dir -type d -empty -exec rmdir -p {} + 2>/dev/null

# Heuristically determine source directories based on Maven structure.
# Always include the $SRC root as it likely contains the fuzzer sources.
Expand Down

0 comments on commit 5f896ed

Please sign in to comment.