diff options
author | Marco Castelluccio <mcastelluccio@mozilla.com> | 2018-07-16 14:40:33 +0000 |
---|---|---|
committer | Marco Castelluccio <mcastelluccio@mozilla.com> | 2018-07-16 14:40:33 +0000 |
commit | 71ef6e555c119f171bae104958f93e2e66581ad2 (patch) | |
tree | 95d3643328ab48f690154a1b7520a2e2dad10ad7 | |
parent | f0786cf087d6740f281b7b8093066a47a706d29a (diff) |
[gcov] Add a test showing differences in line counts when building with or without exceptions enabled.
Test for https://bugs.llvm.org/show_bug.cgi?id=38066.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337174 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/profile/Inputs/instrprof-gcov-exceptions.cpp | 11 | ||||
-rw-r--r-- | test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov | 16 | ||||
-rw-r--r-- | test/profile/instrprof-gcov-exceptions.test | 21 |
3 files changed, 48 insertions, 0 deletions
diff --git a/test/profile/Inputs/instrprof-gcov-exceptions.cpp b/test/profile/Inputs/instrprof-gcov-exceptions.cpp new file mode 100644 index 000000000..327966551 --- /dev/null +++ b/test/profile/Inputs/instrprof-gcov-exceptions.cpp @@ -0,0 +1,11 @@ +#include <string> + +void asd(std::string i) { +} + +int main(void) +{ + asd("22"); + + return 0; +} diff --git a/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov b/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov new file mode 100644 index 000000000..7caf50806 --- /dev/null +++ b/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov @@ -0,0 +1,16 @@ +// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-exceptions.cpp +// CHECK-NEXT: -: 0:Graph:instrprof-gcov-exceptions.gcno +// CHECK-NEXT: -: 0:Data:instrprof-gcov-exceptions.gcda +// CHECK-NEXT: -: 0:Runs:1 +// CHECK-NEXT: -: 0:Programs:1 +// CHECK-NEXT: -: 1:#include <string> +// CHECK-NEXT: -: 2: +// CHECK-NEXT: -: 3:void asd(std::string i) { +// CHECK-NEXT: 2: 4:} +// CHECK-NEXT: -: 5: +// CHECK-NEXT: -: 6:int main(void) +// CHECK-NEXT: -: 7:{ +// CHECK-NEXT: 1: 8: asd("22"); +// CHECK-NEXT: -: 9: +// CHECK-NEXT: 1: 10: return 0; +// CHECK-NEXT: -: 11:} diff --git a/test/profile/instrprof-gcov-exceptions.test b/test/profile/instrprof-gcov-exceptions.test new file mode 100644 index 000000000..20ca47a95 --- /dev/null +++ b/test/profile/instrprof-gcov-exceptions.test @@ -0,0 +1,21 @@ +RUN: mkdir -p %t.d +RUN: cd %t.d + +# Test with exceptions disabled. +RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp -fno-exceptions +RUN: test -f instrprof-gcov-exceptions.gcno + +RUN: rm -f instrprof-gcov-exceptions.gcda +RUN: %run %t +RUN: llvm-cov gcov instrprof-gcov-exceptions.gcda +RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-exceptions.cpp.gcov %S/Inputs/instrprof-gcov-exceptions.cpp.gcov + +# Test with exceptions enabled, the result in terms of line counts should be the same. +RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp +RUN: test -f instrprof-gcov-exceptions.gcno + +RUN: rm -f instrprof-gcov-exceptions.gcda +RUN: %run %t +RUN: llvm-cov gcov instrprof-gcov-exceptions.gcda +# The result should be the same, not using XFAIL as only this part of the test is failing. +RUN: not FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-exceptions.cpp.gcov %S/Inputs/instrprof-gcov-exceptions.cpp.gcov |