[gcov][test] Call wait() to make gcov-fork.c reliable
authorFangrui Song <i@maskray.me>
Sat, 18 Jul 2020 18:10:18 +0000 (11:10 -0700)
committerFangrui Song <i@maskray.me>
Sat, 18 Jul 2020 18:10:47 +0000 (11:10 -0700)
commitca1cc5c4e067d496e92e775bd0ac30c1b775bb62
treed085b041efc0fd9678bf244f9efce819d06473db
parente79a86e45b21cacc57e0cb8bd40d137d8768fc26
[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     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiler-rt/test/profile/Posix/gcov-fork.c