From 71ef6e555c119f171bae104958f93e2e66581ad2 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Mon, 16 Jul 2018 14:40:33 +0000 Subject: [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 --- test/profile/Inputs/instrprof-gcov-exceptions.cpp | 11 +++++++++++ .../Inputs/instrprof-gcov-exceptions.cpp.gcov | 16 ++++++++++++++++ test/profile/instrprof-gcov-exceptions.test | 21 +++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 test/profile/Inputs/instrprof-gcov-exceptions.cpp create mode 100644 test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov create mode 100644 test/profile/instrprof-gcov-exceptions.test (limited to 'test') 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 + +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 +// 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 -- cgit v1.2.3