summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-02-19 20:45:00 +0000
committerVedant Kumar <vsk@apple.com>2019-02-19 20:45:00 +0000
commita0b97254797873b69ad5087ef748aebcf4426db8 (patch)
tree48122189823617ac729b4abd4c93d0bd35511182 /llvm/test/tools
parent069af04a4a3855bd0b7d7f1bdad8a0d8bb10db85 (diff)
downloadbcm5719-llvm-a0b97254797873b69ad5087ef748aebcf4426db8.tar.gz
bcm5719-llvm-a0b97254797873b69ad5087ef748aebcf4426db8.zip
[llvm-cov] Add support for gcov --hash-filenames option
The patch adds support for --hash-filenames to llvm-cov. This option adds md5 hash of the source path to the name of the generated .gcov file. The option is crucial for cases where you have multiple files with the same name but can't use --preserve-paths as resulting filenames exceed the limit. from gcov(1): ``` -x --hash-filenames By default, gcov uses the full pathname of the source files to to create an output filename. This can lead to long filenames that can overflow filesystem limits. This option creates names of the form source-file##md5.gcov, where the source-file component is the final filename part and the md5 component is calculated from the full mangled name that would have been used otherwise. ``` Patch by Igor Ignatev! Differential Revision: https://reviews.llvm.org/D58370 llvm-svn: 354379
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_hash.output8
-rw-r--r--llvm/test/tools/llvm-cov/llvm-cov.test5
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_hash.output b/llvm/test/tools/llvm-cov/Inputs/test_hash.output
new file mode 100644
index 00000000000..3f8b3f614d5
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/test_hash.output
@@ -0,0 +1,8 @@
+File 'srcdir/./nested_dir/../test.cpp'
+Lines executed:84.21% of 38
+srcdir/./nested_dir/../test.cpp:creating 'test.cpp##a806e5b3093cd6f683da88c0da150daf.gcov'
+
+File 'srcdir/./nested_dir/../test.h'
+Lines executed:100.00% of 1
+srcdir/./nested_dir/../test.h:creating 'test.h##0cbee7e2421fa4517420ac4f935620ca.gcov'
+
diff --git a/llvm/test/tools/llvm-cov/llvm-cov.test b/llvm/test/tools/llvm-cov/llvm-cov.test
index d460f37da2a..1ddbdad15cd 100644
--- a/llvm/test/tools/llvm-cov/llvm-cov.test
+++ b/llvm/test/tools/llvm-cov/llvm-cov.test
@@ -63,6 +63,11 @@ RUN: llvm-cov gcov -lp -gcno test_paths.gcno -gcda test_paths.gcda srcdir/../tes
RUN: diff -aub test_paths.cpp.gcov srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.cpp.gcov
RUN: diff -aub test_paths.h.gcov srcdir#^#test_paths.cpp##srcdir#nested_dir#^#test.h.gcov
+# Hash pathnames.
+RUN: llvm-cov gcov -x -gcno test_paths.gcno -gcda test_paths.gcda srcdir/../test_paths.cpp | diff -u test_hash.output -
+RUN: diff -aub test_paths.cpp.gcov test.cpp##a806e5b3093cd6f683da88c0da150daf.gcov
+RUN: diff -aub test_paths.h.gcov test.h##0cbee7e2421fa4517420ac4f935620ca.gcov
+
# Function summaries. This changes stdout, but not the gcov files.
RUN: llvm-cov gcov test.c -f | diff -u test_-f.output -
RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov
OpenPOWER on IntegriCloud