[compiler-rt] b2ffe94 - [gcov] Fix instrprof-gcov-__gcov_flush-terminate.test

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 09:32:01 PDT 2020


Author: Fangrui Song
Date: 2020-06-07T09:31:52-07:00
New Revision: b2ffe940b0353b64badf6290d14027a116d2ce59

URL: https://github.com/llvm/llvm-project/commit/b2ffe940b0353b64badf6290d14027a116d2ce59
DIFF: https://github.com/llvm/llvm-project/commit/b2ffe940b0353b64badf6290d14027a116d2ce59.diff

LOG: [gcov] Fix instrprof-gcov-__gcov_flush-terminate.test

Added: 
    compiler-rt/test/profile/gcov-__gcov_flush-terminate.c

Modified: 
    

Removed: 
    compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c
    compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov
    compiler-rt/test/profile/instrprof-gcov-__gcov_flush-terminate.test


################################################################################
diff  --git a/compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c b/compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c
deleted file mode 100644
index 7b24d69c75fc..000000000000
--- a/compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c
+++ /dev/null
@@ -1,13 +0,0 @@
-int main(void) {
-  int i = 22;
-
-  __gcov_flush();
-
-  i = 42;
-
-  asm("int $3");
-
-  i = 84;
-
-  return 0;
-}

diff  --git a/compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov b/compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov
deleted file mode 100644
index 24a09066c25f..000000000000
--- a/compiler-rt/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov
+++ /dev/null
@@ -1,18 +0,0 @@
-// CHECK:        -:    0:Source:{{.*}}Inputs{{[/\\]}}instrprof-gcov-__gcov_flush-terminate.c
-// CHECK-NEXT:        -:    0:Graph:instrprof-gcov-__gcov_flush-terminate.gcno
-// CHECK-NEXT:        -:    0:Data:instrprof-gcov-__gcov_flush-terminate.gcda
-// CHECK-NEXT:        -:    0:Runs:1
-// CHECK-NEXT:        -:    0:Programs:1
-// CHECK-NEXT:        1:    1:int main(void) {
-// CHECK-NEXT:        1:    2:  int i = 22;
-// CHECK-NEXT:        -:    3:
-// CHECK-NEXT:        1:    4:  __gcov_flush();
-// CHECK-NEXT:        -:    5:
-// CHECK-NEXT:        1:    6:  i = 42;
-// CHECK-NEXT:        -:    7:
-// CHECK-NEXT:        1:    8:  asm("int $3");
-// CHECK-NEXT:        -:    9:
-// CHECK-NEXT:        1:   10:  i = 84;
-// CHECK-NEXT:        -:   11:
-// CHECK-NEXT:        1:   12:  return 0;
-// CHECK-NEXT:        -:   13:}

diff  --git a/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c b/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c
new file mode 100644
index 000000000000..c0c443c0e9dd
--- /dev/null
+++ b/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c
@@ -0,0 +1,31 @@
+/// https://bugs.llvm.org/show_bug.cgi?id=38067
+/// An abnormal exit does not clear execution counts of subsequent instructions.
+// RUN: mkdir -p %t.dir && cd %t.dir
+// RUN: %clang --coverage %s -o %t
+// RUN: test -f gcov-__gcov_flush-terminate.gcno
+
+// RUN: rm -f gcov-__gcov_flush-terminate.gcda && %expect_crash %run %t
+// RUN: llvm-cov gcov -t gcov-__gcov_flush-terminate.gcda | FileCheck %s
+
+// CHECK:             -:    0:Runs:1
+// CHECK-NEXT:        -:    0:Programs:1
+// CHECK:             -:    1:void __gcov_flush(void);
+// CHECK-NEXT:        -:    2:
+// CHECK-NEXT:        1:    3:int main(void) {
+// CHECK-NEXT:        1:    4:  int i = 22;
+// CHECK-NEXT:        1:    5:  __gcov_flush();
+// CHECK-NEXT:        1:    6:  i = 42;
+// CHECK-NEXT:        1:    7:  __builtin_trap();
+// CHECK-NEXT:        1:    8:  i = 84;
+// CHECK-NEXT:        1:    9:  return 0;
+
+void __gcov_flush(void);
+
+int main(void) {
+  int i = 22;
+  __gcov_flush();
+  i = 42;
+  __builtin_trap();
+  i = 84;
+  return 0;
+}

diff  --git a/compiler-rt/test/profile/instrprof-gcov-__gcov_flush-terminate.test b/compiler-rt/test/profile/instrprof-gcov-__gcov_flush-terminate.test
deleted file mode 100644
index 1c8ea2ac602d..000000000000
--- a/compiler-rt/test/profile/instrprof-gcov-__gcov_flush-terminate.test
+++ /dev/null
@@ -1,10 +0,0 @@
-RUN: mkdir -p %t.d
-RUN: cd %t.d
-
-RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c
-RUN: test -f instrprof-gcov-__gcov_flush-terminate.gcno
-
-RUN: rm -f instrprof-gcov-__gcov_flush-terminate.gcda
-RUN: %expect_crash %run %t
-RUN: llvm-cov gcov instrprof-gcov-__gcov_flush-terminate.gcda
-RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-__gcov_flush-terminate.c.gcov %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov


        


More information about the llvm-commits mailing list