From: Marco Castelluccio Date: Mon, 16 Jul 2018 14:40:33 +0000 (+0000) Subject: [gcov] Add a test showing differences in line counts when building with or without... X-Git-Tag: llvmorg-7.0.0-rc1~1350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f0b194b4a51623aec90594e92df635ab5444251;p=platform%2Fupstream%2Fllvm.git [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. llvm-svn: 337174 --- diff --git a/compiler-rt/test/profile/Inputs/instrprof-gcov-exceptions.cpp b/compiler-rt/test/profile/Inputs/instrprof-gcov-exceptions.cpp new file mode 100644 index 0000000..3279665 --- /dev/null +++ b/compiler-rt/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/compiler-rt/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov b/compiler-rt/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov new file mode 100644 index 0000000..7caf5080 --- /dev/null +++ b/compiler-rt/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/compiler-rt/test/profile/instrprof-gcov-exceptions.test b/compiler-rt/test/profile/instrprof-gcov-exceptions.test new file mode 100644 index 0000000..20ca47a --- /dev/null +++ b/compiler-rt/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