diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2018-03-21 18:11:17 -0400 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2018-04-05 13:39:49 -0400 |
commit | bc71dfb5c27cc91096ac9c762b850719cee7751b (patch) | |
tree | cf89ce55c05b02a42f0785aede885bbf3d2748c8 | |
parent | b27f7bc476c35beedb43d02913d8d2175e6f1fb2 (diff) | |
download | mongo-bc71dfb5c27cc91096ac9c762b850719cee7751b.tar.gz |
SERVER-33484 Code coverage can't distinguish between files with identical names, add a unique prefix to all *.gcda.gov files.
(cherry picked from commit 220a857ffc84cf755fa7d387f19d537a249bd099)
-rw-r--r-- | etc/evergreen.yml | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/etc/evergreen.yml b/etc/evergreen.yml index d6088b78040..0c8b8f768e4 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -1009,13 +1009,32 @@ post: params: working_dir: src script: | + set +o errexit if [ -d "./build" ]; then - file_list=$(find ./build -type f -name "*.gcda") - if [ -n "$file_list" ]; then - for gcda_file in $file_list; do - /opt/mongodbtoolchain/v2/bin/gcov -i $gcda_file - done - fi + file_list=$(find ./build -type f -name "*.gcda") + if [ -n "$file_list" ]; then + for gcda_file in $file_list; do + echo "Processing file $gcda_file" + /opt/mongodbtoolchain/v2/bin/gcov -i $gcda_file + base_name=$(echo $gcda_file | rev | cut -f1 -d '/' | cut -f2 -d '.' | rev) + gcov_file=$base_name.gcda.gcov + if [ -f "$gcov_file" ]; then + # Add a prefix to the intermediate file, since it does not have a unique name. + # Convert the '/' to '#' in the file path. + file_prefix=$(echo $gcda_file | sed -e 's,^\./,,' | rev | cut -f2- -d '/' | rev | tr -s '/' '#') + new_gcov_file=$file_prefix#$base_name.gcda.gcov + if [ ! -f $new_gcov_file ]; then + echo "Renaming gcov intermediate file $gcov_file to $new_gcov_file" + mv $gcov_file $new_gcov_file + else + # We treat this as a fatal condition and remove all of the coverage files. + echo "Not renaming $gcov_file as $new_gcov_file already exists!" + rm -f *.gcda.gcov + exit 1 + fi + fi + done + fi fi - command: archive.targz_pack params: |