diff options
Diffstat (limited to 'test/tools/llvm-cov')
24 files changed, 82 insertions, 51 deletions
diff --git a/test/tools/llvm-cov/Inputs/binary-formats.macho32b b/test/tools/llvm-cov/Inputs/binary-formats.macho32b Binary files differnew file mode 100755 index 0000000..bb9f356 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/binary-formats.macho32b diff --git a/test/tools/llvm-cov/Inputs/binary-formats.macho32l b/test/tools/llvm-cov/Inputs/binary-formats.macho32l Binary files differnew file mode 100755 index 0000000..2dd4c44 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/binary-formats.macho32l diff --git a/test/tools/llvm-cov/Inputs/binary-formats.macho64l b/test/tools/llvm-cov/Inputs/binary-formats.macho64l Binary files differnew file mode 100755 index 0000000..0045c43 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/binary-formats.macho64l diff --git a/test/tools/llvm-cov/Inputs/binary-formats.proftext b/test/tools/llvm-cov/Inputs/binary-formats.proftext new file mode 100644 index 0000000..97816c2 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/binary-formats.proftext @@ -0,0 +1,4 @@ +main +0x0 +1 +100 diff --git a/test/tools/llvm-cov/Inputs/lineExecutionCounts.profdata b/test/tools/llvm-cov/Inputs/lineExecutionCounts.profdata Binary files differdeleted file mode 100644 index 8712227..0000000 --- a/test/tools/llvm-cov/Inputs/lineExecutionCounts.profdata +++ /dev/null diff --git a/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext b/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext new file mode 100644 index 0000000..1966d42 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext @@ -0,0 +1,8 @@ +main +0x000000000028434d +5 +1 +0 +100 +1 +0 diff --git a/test/tools/llvm-cov/Inputs/regionMarkers.profdata b/test/tools/llvm-cov/Inputs/regionMarkers.profdata Binary files differdeleted file mode 100644 index 8712227..0000000 --- a/test/tools/llvm-cov/Inputs/regionMarkers.profdata +++ /dev/null diff --git a/test/tools/llvm-cov/Inputs/regionMarkers.proftext b/test/tools/llvm-cov/Inputs/regionMarkers.proftext new file mode 100644 index 0000000..1966d42 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/regionMarkers.proftext @@ -0,0 +1,8 @@ +main +0x000000000028434d +5 +1 +0 +100 +1 +0 diff --git a/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda b/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda Binary files differnew file mode 100644 index 0000000..3ca483d --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcda diff --git a/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno b/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno Binary files differnew file mode 100644 index 0000000..d453566 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/test_exit_block_arcs.gcno diff --git a/test/tools/llvm-cov/Inputs/universal-binary b/test/tools/llvm-cov/Inputs/universal-binary Binary files differnew file mode 100755 index 0000000..aad5758 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/universal-binary diff --git a/test/tools/llvm-cov/Inputs/universal-binary.proftext b/test/tools/llvm-cov/Inputs/universal-binary.proftext new file mode 100644 index 0000000..97816c2 --- /dev/null +++ b/test/tools/llvm-cov/Inputs/universal-binary.proftext @@ -0,0 +1,4 @@ +main +0x0 +1 +100 diff --git a/test/tools/llvm-cov/binary-formats.c b/test/tools/llvm-cov/binary-formats.c new file mode 100644 index 0000000..31c6c4c --- /dev/null +++ b/test/tools/llvm-cov/binary-formats.c @@ -0,0 +1,9 @@ +// Checks for reading various formats. + +// CHECK: 100| [[@LINE+1]]|int main +int main(int argc, const char *argv[]) {} + +// RUN: llvm-profdata merge %S/Inputs/binary-formats.proftext -o %t.profdata +// RUN: llvm-cov show %S/Inputs/binary-formats.macho32l -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s +// RUN: llvm-cov show %S/Inputs/binary-formats.macho64l -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s +// RUN: llvm-cov show %S/Inputs/binary-formats.macho32b -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s diff --git a/test/tools/llvm-cov/copy_block_helper.m b/test/tools/llvm-cov/copy_block_helper.m index 64973f1..d8202d0 100644 --- a/test/tools/llvm-cov/copy_block_helper.m +++ b/test/tools/llvm-cov/copy_block_helper.m @@ -9,7 +9,7 @@ // RUN: cd %t // RUN: cp %s %p/Inputs/copy_block_helper.gc* . -// RUN: llvm-cov copy_block_helper.m | FileCheck %s --check-prefix=STDOUT +// RUN: llvm-cov gcov copy_block_helper.m | FileCheck %s --check-prefix=STDOUT // STDOUT: File 'copy_block_helper.m' // STDOUT: Lines executed:100.00% of 5 // STDOUT: copy_block_helper.m:creating 'copy_block_helper.m.gcov' diff --git a/test/tools/llvm-cov/lit.local.cfg b/test/tools/llvm-cov/lit.local.cfg index 650bc02..05aef86 100644 --- a/test/tools/llvm-cov/lit.local.cfg +++ b/test/tools/llvm-cov/lit.local.cfg @@ -1,5 +1 @@ -config.suffixes = ['.test', '.m', '.cpp'] - -# http://llvm.org/bugs/show_bug.cgi?id=20979 -if 'ubsan' in config.available_features: - config.unsupported = True +config.suffixes = ['.test', '.m', '.cpp', '.c'] diff --git a/test/tools/llvm-cov/llvm-cov.test b/test/tools/llvm-cov/llvm-cov.test index 0d3eb6b..ba5e18a 100644 --- a/test/tools/llvm-cov/llvm-cov.test +++ b/test/tools/llvm-cov/llvm-cov.test @@ -1,7 +1,8 @@ # Tests for compatibility between llvm-cov and gcov. These work by # comparing llvm-cov against reference outputs generated by gcov 4.2. -# "cd" and globbing are unsupported in lit internal runner. +# Test fails on Windows where internal shell is used due to path separator +# mismatches. REQUIRES: shell RUN: rm -rf %t @@ -10,70 +11,70 @@ RUN: cd %t RUN: cp %p/Inputs/test* . # Basic behaviour with no flags -RUN: llvm-cov test.c | diff -u test_no_options.output - +RUN: llvm-cov gcov test.c | diff -u test_no_options.output - RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov RUN: diff -aub test_no_options.h.gcov test.h.gcov # Same, but specifying the object directory RUN: mkdir -p %t/objdir RUN: cp test.gcno test.gcda %t/objdir -RUN: llvm-cov -o objdir test.c | diff -u test_no_options.output - +RUN: llvm-cov gcov -o objdir test.c | diff -u test_no_options.output - RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov RUN: diff -aub test_objdir.h.gcov test.h.gcov # Specifying an object file -RUN: llvm-cov -o objdir/test.o test.c | diff -u test_no_options.output - +RUN: llvm-cov gcov -o objdir/test.o test.c | diff -u test_no_options.output - RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov RUN: diff -aub test_objdir.h.gcov test.h.gcov # Specifying an object file that could be ambiguous with a directory -RUN: llvm-cov -o objdir/test test.c | diff -u test_no_options.output - +RUN: llvm-cov gcov -o objdir/test test.c | diff -u test_no_options.output - RUN: diff -aub test_objdir.cpp.gcov test.cpp.gcov RUN: diff -aub test_objdir.h.gcov test.h.gcov # With gcov output disabled -RUN: llvm-cov -n test.c | diff -u test_no_output.output - +RUN: llvm-cov gcov -n test.c | diff -u test_no_output.output - # Missing source files. This test is fragile, as it depends on being # run before we copy some sources into place in the next test. -RUN: llvm-cov test_paths.cpp 2>/dev/null | diff -u test_missing.output - +RUN: llvm-cov gcov test_paths.cpp 2>/dev/null | diff -u test_missing.output - RUN: diff -aub test_missing.cpp.gcov test.cpp.gcov RUN: diff -aub test_missing.h.gcov test.h.gcov # Preserve paths. This mangles the output filenames. RUN: mkdir -p %t/srcdir/nested_dir RUN: cp test.cpp test.h %t/srcdir -RUN: llvm-cov -p test_paths.cpp | diff -u test_preserve_paths.output - +RUN: llvm-cov gcov -p test_paths.cpp | diff -u test_preserve_paths.output - RUN: diff -aub test_paths.cpp.gcov srcdir#nested_dir#^#test.cpp.gcov RUN: diff -aub test_paths.h.gcov srcdir#nested_dir#^#test.h.gcov # Don't preserve paths. Same results as preserve paths, but no mangling. -RUN: llvm-cov test_paths.cpp | diff -u test_no_preserve_paths.output - +RUN: llvm-cov gcov test_paths.cpp | diff -u test_no_preserve_paths.output - RUN: diff -aub test_paths.cpp.gcov test.cpp.gcov RUN: diff -aub test_paths.h.gcov test.h.gcov # Long file names. -RUN: llvm-cov -l test_paths.cpp | diff -u test_long_file_names.output - +RUN: llvm-cov gcov -l test_paths.cpp | diff -u test_long_file_names.output - RUN: diff -aub test_paths.cpp.gcov test_paths.cpp##test.cpp.gcov RUN: diff -aub test_paths.h.gcov test_paths.cpp##test.h.gcov # Long file names and preserve paths. -RUN: llvm-cov -lp -gcno test_paths.gcno -gcda test_paths.gcda srcdir/../test_paths.cpp | diff -u test_long_paths.output - +RUN: llvm-cov gcov -lp -gcno test_paths.gcno -gcda test_paths.gcda srcdir/../test_paths.cpp | diff -u test_long_paths.output - 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 # Function summaries. This changes stdout, but not the gcov files. -RUN: llvm-cov test.c -f | diff -u test_-f.output - +RUN: llvm-cov gcov test.c -f | diff -u test_-f.output - RUN: diff -aub test_no_options.cpp.gcov test.cpp.gcov RUN: diff -aub test_no_options.h.gcov test.h.gcov # All blocks. This doesn't affect stdout, only the gcov files. -RUN: llvm-cov test.c -a | diff -u test_no_options.output - +RUN: llvm-cov gcov test.c -a | diff -u test_no_options.output - RUN: diff -aub test_-a.cpp.gcov test.cpp.gcov RUN: diff -aub test_-a.h.gcov test.h.gcov # Branch probabilities. -RUN: llvm-cov test.c -a -b | diff -u test_-b.output - +RUN: llvm-cov gcov test.c -a -b | diff -u test_-b.output - RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov RUN: diff -aub test_-a_-b.h.gcov test.h.gcov @@ -82,32 +83,36 @@ RUN: diff -aub test_-a_-b.h.gcov test.h.gcov # FIXME: We don't correctly handle calls when -b and -f are used # together, so our output differs from gcov. Remove the 'not' from # this test once this is fixed. -RUN: llvm-cov test.c -a -b -f | not diff -u test_-b_-f.output - >/dev/null +RUN: llvm-cov gcov test.c -a -b -f | not diff -u test_-b_-f.output - >/dev/null RUN: diff -aub test_-a_-b.cpp.gcov test.cpp.gcov RUN: diff -aub test_-a_-b.h.gcov test.h.gcov # Summarize unconditional branches too. -RUN: llvm-cov test.c -a -b -u | diff -u test_-b.output - +RUN: llvm-cov gcov test.c -a -b -u | diff -u test_-b.output - RUN: diff -aub test_-a_-b_-u.cpp.gcov test.cpp.gcov RUN: diff -aub test_-a_-b_-u.h.gcov test.h.gcov # Absolute counts for branches. -RUN: llvm-cov test.c -a -b -c -u | diff -u test_-b.output - +RUN: llvm-cov gcov test.c -a -b -c -u | diff -u test_-b.output - RUN: diff -aub test_-a_-b_-c_-u.cpp.gcov test.cpp.gcov RUN: diff -aub test_-a_-b_-c_-u.h.gcov test.h.gcov # Missing gcda file just gives 0 counts. -RUN: llvm-cov test.c -gcda=no_such_gcda_file | diff -u test_no_gcda.output - +RUN: llvm-cov gcov test.c -gcda=no_such_gcda_file | diff -u test_no_gcda.output - RUN: diff -aub test_no_gcda.cpp.gcov test.cpp.gcov RUN: diff -aub test_no_gcda.h.gcov test.h.gcov # Invalid gcno file. -RUN: llvm-cov test.c -gcno=test_read_fail.gcno +RUN: llvm-cov gcov test.c -gcno=test_read_fail.gcno # Bad file checksum on gcda. -RUN: llvm-cov test.c -gcda=test_file_checksum_fail.gcda +RUN: llvm-cov gcov test.c -gcda=test_file_checksum_fail.gcda # Bad function checksum on gcda -RUN: llvm-cov test.c -gcda=test_func_checksum_fail.gcda +RUN: llvm-cov gcov test.c -gcda=test_func_checksum_fail.gcda + +# Has arcs from exit blocks +RUN: llvm-cov gcov test_exit_block_arcs.c 2>&1 | FileCheck %s -check-prefix=EXIT_BLOCK_ARCS +EXIT_BLOCK_ARCS: (main) has arcs from exit block. XFAIL: powerpc64-, s390x, mips-, mips64-, sparc diff --git a/test/tools/llvm-cov/range_based_for.cpp b/test/tools/llvm-cov/range_based_for.cpp index 3fdb244..6f7a11a 100644 --- a/test/tools/llvm-cov/range_based_for.cpp +++ b/test/tools/llvm-cov/range_based_for.cpp @@ -9,7 +9,7 @@ // RUN: cd %t // RUN: cp %s %p/Inputs/range_based_for.gc* . -// RUN: llvm-cov range_based_for.cpp | FileCheck %s --check-prefix=STDOUT +// RUN: llvm-cov gcov range_based_for.cpp | FileCheck %s --check-prefix=STDOUT // STDOUT: File 'range_based_for.cpp' // STDOUT: Lines executed:100.00% of 5 // STDOUT: range_based_for.cpp:creating 'range_based_for.cpp.gcov' diff --git a/test/tools/llvm-cov/report.cpp b/test/tools/llvm-cov/report.cpp index 570012e..3322e1a 100644 --- a/test/tools/llvm-cov/report.cpp +++ b/test/tools/llvm-cov/report.cpp @@ -1,5 +1,5 @@ -// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -no-colors -filename-equivalence 2>&1 | FileCheck %s -// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -no-colors -filename-equivalence report.cpp 2>&1 | FileCheck -check-prefix=FILT-NEXT %s +// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence 2>&1 | FileCheck %s +// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence report.cpp 2>&1 | FileCheck -check-prefix=FILT-NEXT %s // CHECK: Filename Regions Miss Cover Functions Executed // CHECK-NEXT: --- @@ -33,6 +33,3 @@ int main() { bar(); return 0; } - -// llvm-cov doesn't work on big endian yet -// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc diff --git a/test/tools/llvm-cov/showExpansions.cpp b/test/tools/llvm-cov/showExpansions.cpp index 30edd90..de3898f 100644 --- a/test/tools/llvm-cov/showExpansions.cpp +++ b/test/tools/llvm-cov/showExpansions.cpp @@ -24,6 +24,3 @@ int main(int argc, const char *argv[]) { DO_SOMETHING(i); // CHECK-DAG: Expansion at line [[@LINE]], 5 -> 17 return 0; } - -// llvm-cov doesn't work on big endian yet -// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc diff --git a/test/tools/llvm-cov/showHighlightedRanges.cpp b/test/tools/llvm-cov/showHighlightedRanges.cpp index 1ff7929..b5209d4 100644 --- a/test/tools/llvm-cov/showHighlightedRanges.cpp +++ b/test/tools/llvm-cov/showHighlightedRanges.cpp @@ -43,6 +43,3 @@ int main() { func2(9); return 0; } - -// llvm-cov doesn't work on big endian yet -// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc diff --git a/test/tools/llvm-cov/showLineExecutionCounts.cpp b/test/tools/llvm-cov/showLineExecutionCounts.cpp index 625c3f2..d5254da 100644 --- a/test/tools/llvm-cov/showLineExecutionCounts.cpp +++ b/test/tools/llvm-cov/showLineExecutionCounts.cpp @@ -1,5 +1,5 @@ -// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %S/Inputs/lineExecutionCounts.profdata -no-colors -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=WHOLE-FILE %s -// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %S/Inputs/lineExecutionCounts.profdata -no-colors -filename-equivalence -name=main %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s +// Basic handling of line counts. +// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata // before any coverage // WHOLE-FILE: | [[@LINE]]|// before // FILTER-NOT: | [[@LINE-1]]|// before @@ -26,5 +26,5 @@ int main() { // CHECK: 1| [[@LINE]]|int main( // after coverage // WHOLE-FILE: | [[@LINE]]|// after // FILTER-NOT: | [[@LINE-1]]|// after -// llvm-cov doesn't work on big endian yet -// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc +// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=WHOLE-FILE %s +// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence -name=main %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s diff --git a/test/tools/llvm-cov/showRegionMarkers.cpp b/test/tools/llvm-cov/showRegionMarkers.cpp index 136c3bf..d1b83d2 100644 --- a/test/tools/llvm-cov/showRegionMarkers.cpp +++ b/test/tools/llvm-cov/showRegionMarkers.cpp @@ -1,4 +1,4 @@ -// RUN: llvm-cov show %S/Inputs/regionMarkers.covmapping -instr-profile %S/Inputs/regionMarkers.profdata -show-regions -dump -filename-equivalence %s 2>&1 | FileCheck %s +// RUN: llvm-profdata merge %S/Inputs/regionMarkers.proftext -o %t.profdata int main() { // CHECK: Marker at [[@LINE]]:12 = 1 int x = 0; @@ -22,5 +22,4 @@ int main() { // CHECK: Marker at [[@LINE]]:12 = 1 return 0; } -// llvm-cov doesn't work on big endian yet -// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc +// RUN: llvm-cov show %S/Inputs/regionMarkers.covmapping -instr-profile %t.profdata -show-regions -dump -filename-equivalence %s 2>&1 | FileCheck %s diff --git a/test/tools/llvm-cov/showTemplateInstantiations.cpp b/test/tools/llvm-cov/showTemplateInstantiations.cpp index 2b72d83..a9be473 100644 --- a/test/tools/llvm-cov/showTemplateInstantiations.cpp +++ b/test/tools/llvm-cov/showTemplateInstantiations.cpp @@ -1,5 +1,5 @@ -// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -no-colors -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=ALL %s -// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -no-colors -filename-equivalence -name=_Z4funcIbEiT_ %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s +// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=ALL %s +// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -filename-equivalence -name=_Z4funcIbEiT_ %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s // before coverage // WHOLE-FILE: | [[@LINE]]|// before // FILTER-NOT: | [[@LINE-1]]|// before @@ -38,6 +38,3 @@ int main() { // ALL: 1| [[@LINE]]|int main() { } // ALL-NEXT: 1| [[@LINE]]|} // after coverage // ALL-NEXT: | [[@LINE]]|// after // FILTER-NOT: | [[@LINE-1]]|// after - -// llvm-cov doesn't work on big endian yet -// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc diff --git a/test/tools/llvm-cov/universal-binary.c b/test/tools/llvm-cov/universal-binary.c new file mode 100644 index 0000000..8ff94d4 --- /dev/null +++ b/test/tools/llvm-cov/universal-binary.c @@ -0,0 +1,10 @@ +// The coverage reader should be able to handle universal binaries + +// CHECK: 100| [[@LINE+1]]|int main +int main(int argc, const char *argv[]) {} + +// RUN: llvm-profdata merge %S/Inputs/universal-binary.proftext -o %t.profdata +// RUN: llvm-cov show %S/Inputs/universal-binary -instr-profile %t.profdata -filename-equivalence %s -arch x86_64 | FileCheck %s + +// RUN: not llvm-cov show %S/Inputs/universal-binary -instr-profile %t.profdata -filename-equivalence %s -arch i386 2>&1 | FileCheck --check-prefix=WRONG-ARCH %s +// WRONG-ARCH: Failed to load coverage |