[compiler-rt] r337174 - [gcov] Add a test showing differences in line counts when building with or without exceptions enabled.

Marco Castelluccio via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 07:40:33 PDT 2018


Author: marco
Date: Mon Jul 16 07:40:33 2018
New Revision: 337174

URL: http://llvm.org/viewvc/llvm-project?rev=337174&view=rev
Log:
[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.

Added:
    compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp
    compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov
    compiler-rt/trunk/test/profile/instrprof-gcov-exceptions.test

Added: compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp?rev=337174&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp Mon Jul 16 07:40:33 2018
@@ -0,0 +1,11 @@
+#include <string>
+
+void asd(std::string i) {
+}
+
+int main(void)
+{
+  asd("22");
+
+  return 0;
+}

Added: compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov?rev=337174&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov (added)
+++ compiler-rt/trunk/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov Mon Jul 16 07:40:33 2018
@@ -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:}

Added: compiler-rt/trunk/test/profile/instrprof-gcov-exceptions.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/profile/instrprof-gcov-exceptions.test?rev=337174&view=auto
==============================================================================
--- compiler-rt/trunk/test/profile/instrprof-gcov-exceptions.test (added)
+++ compiler-rt/trunk/test/profile/instrprof-gcov-exceptions.test Mon Jul 16 07:40:33 2018
@@ -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




More information about the llvm-commits mailing list