1/// A basic block with fork/exec* is split. .gcda is flushed immediately before
2/// fork/exec* so the lines before exec* are counted once while succeeding
3/// lines are not counted.
4// RUN: mkdir -p %t.d && cd %t.d
5// RUN: %clang --coverage %s -o %t -dumpdir ./
6// RUN: test -f gcov-execlp.gcno
7// RUN: rm -f gcov-execlp.gcda && %run %t
8// RUN: llvm-cov gcov -t gcov-execlp.gcda | FileCheck %s --check-prefixes=CHECK,EXECLP
9
10// RUN: %clang --coverage -DEXECVP %s -o %t -dumpdir ./
11// RUN: rm -f gcov-execlp.gcda && %run %t
12// RUN: llvm-cov gcov -t gcov-execlp.gcda | FileCheck %s --check-prefixes=CHECK,EXECVP
13
14#include <unistd.h>
15
16void func1(void) {} // CHECK: 1: [[#@LINE]]:void func1(void)
17void func2(void) {} // CHECK-NEXT: #####: [[#@LINE]]:
18int main(void) { // CHECK-NEXT: 1: [[#@LINE]]:
19 func1(); // CHECK-NEXT: 1: [[#@LINE]]:
20#ifdef EXECVP
21 char *argv[] = {"ls", "-l", (char *)0};
22 execvp("ls", argv); // EXECVP: 1: [[#@LINE]]: execvp
23#else
24 execlp(file: "ls", arg: "-l", (char *)0); // EXECLP: 1: [[#@LINE]]: execlp
25#endif
26 func2(); // CHECK: #####: [[#@LINE]]: func2
27 return 0; // CHECK-NEXT: #####: [[#@LINE]]:
28}
29

source code of compiler-rt/test/profile/Posix/gcov-execlp.c