[compiler-rt] ca1cc5c - [gcov][test] Call wait() to make gcov-fork.c reliable
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 18 11:10:57 PDT 2020
Author: Fangrui Song
Date: 2020-07-18T11:10:47-07:00
New Revision: ca1cc5c4e067d496e92e775bd0ac30c1b775bb62
URL: https://github.com/llvm/llvm-project/commit/ca1cc5c4e067d496e92e775bd0ac30c1b775bb62
DIFF: https://github.com/llvm/llvm-project/commit/ca1cc5c4e067d496e92e775bd0ac30c1b775bb62.diff
LOG: [gcov][test] Call wait() to make gcov-fork.c reliable
If the parent exit before the child, the line counts might be 1.
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26: 1: 21: if (fork() == -1) return 1; // CHECK-NEXT: 1: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27: 1: 22: func2(); // CHECK-NEXT: 2: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28: 1: 23: return 0; // CHECK-NEXT: 2: [[#@LINE]]:
next:18'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added:
Modified:
compiler-rt/test/profile/Posix/gcov-fork.c
Removed:
################################################################################
diff --git a/compiler-rt/test/profile/Posix/gcov-fork.c b/compiler-rt/test/profile/Posix/gcov-fork.c
index 4942d5ac9288..022ce716a8dc 100644
--- a/compiler-rt/test/profile/Posix/gcov-fork.c
+++ b/compiler-rt/test/profile/Posix/gcov-fork.c
@@ -1,10 +1,6 @@
/// A basic block with fork/exec* is split. .gcda is flushed immediately before
/// fork/exec* so the lines before fork are counted once while succeeding
/// lines are counted twice.
-// UNSUPPORTED: darwin
-/// FIXME: http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/50913
-// UNSUPPORTED: host-byteorder-big-endian
-
// RUN: mkdir -p %t.d && cd %t.d
// RUN: %clang --coverage %s -o %t
// RUN: test -f gcov-fork.gcno
@@ -17,8 +13,12 @@
void func1() {} // CHECK: 1: [[#@LINE]]:void func1()
void func2() {} // CHECK-NEXT: 2: [[#@LINE]]:
int main(void) { // CHECK-NEXT: 1: [[#@LINE]]:
+ int status; // CHECK-NEXT: -: [[#@LINE]]:
func1(); // CHECK-NEXT: 1: [[#@LINE]]:
- if (fork() == -1) return 1; // CHECK-NEXT: 1: [[#@LINE]]:
+ pid_t pid = fork(); // CHECK-NEXT: 1: [[#@LINE]]:
+ if (pid == -1) return 1; // CHECK-NEXT: 2: [[#@LINE]]:
+ if (pid) // CHECK-NEXT: 2: [[#@LINE]]:
+ wait(&status); // CHECK-NEXT: 1: [[#@LINE]]:
func2(); // CHECK-NEXT: 2: [[#@LINE]]:
return 0; // CHECK-NEXT: 2: [[#@LINE]]:
}
More information about the llvm-commits
mailing list