-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To improve performance of Android unit tests collection. Originated it woocommerce/woocommerce-android#12064
- Loading branch information
Showing
6 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Initialize variables | ||
reports_dir="" | ||
output_file="" | ||
|
||
# Function to show usage | ||
usage() { | ||
echo "Usage: $0 -d <reports_dir> -o <output_file>" | ||
exit 1 | ||
} | ||
|
||
# Parse command-line options | ||
while getopts "d:o:" opt; do | ||
case $opt in | ||
d) reports_dir=$OPTARG ;; | ||
o) output_file=$OPTARG ;; | ||
?) usage ;; | ||
esac | ||
done | ||
|
||
# Check if both arguments were provided | ||
if [ -z "$reports_dir" ] || [ -z "$output_file" ]; then | ||
usage | ||
fi | ||
|
||
# Write XML header to the output file | ||
echo '<?xml version="1.0" encoding="UTF-8"?>' > "$output_file" | ||
echo '<testsuites>' >> "$output_file" | ||
|
||
# Merge the content of all input JUnit files in the directory. | ||
# (Note that in the case of Unit Tests, the JUnit XML files produced by Gradle | ||
# don't have a parent `<testsuites>` root tag, so there's no need to try and remove it) | ||
sed '/<\?xml .*\?>/d' "$reports_dir"/*.xml >> "$output_file" | ||
|
||
# Close the testsuites tag | ||
echo '</testsuites>' >> "$output_file" | ||
|
||
# Print the result | ||
echo "Merged XML reports into $output_file" |