[Profile] Fix fork test and add tests for execlp and execvp after patch https://reviews.llvm.org/D53593

Summary: This is a follow-up of patch https://reviews.llvm.org/D53593

Reviewers: marco-c

Reviewed By: marco-c

Subscribers: delcypher, llvm-commits, #sanitizers, sylvestre.ledru

Differential Revision: https://reviews.llvm.org/D54167

llvm-svn: 346314
This commit is contained in:
Calixte Denizet 2018-11-07 13:51:17 +00:00
parent c3bed1e8e6
commit 5e09c49499
8 changed files with 102 additions and 4 deletions

View File

@ -0,0 +1,15 @@
#include <unistd.h>
void func1() {}
void func2() {}
int main(void)
{
func1();
execlp("ls", "-l", "-h", (char*)0);
func2();
return 0;
}

View File

@ -0,0 +1,23 @@
//CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-execlp.c
//CHECK-NEXT: -: 0:Graph:instrprof-gcov-execlp.gcno
//CHECK-NEXT: -: 0:Data:instrprof-gcov-execlp.gcda
//CHECK-NEXT: -: 0:Runs:1
//CHECK-NEXT: -: 0:Programs:1
//CHECK-NEXT: -: 1:#include <unistd.h>
//CHECK-NEXT: -: 2:
//CHECK-NEXT:function func1 called 1 returned 100% blocks executed 100%
//CHECK-NEXT: 1: 3:void func1() {}
//CHECK-NEXT:function func2 called 0 returned 0% blocks executed 0%
//CHECK-NEXT: #####: 4:void func2() {}
//CHECK-NEXT: -: 5:
//CHECK-NEXT:function main called 1 returned 0% blocks executed 33%
//CHECK-NEXT: 1: 6:int main(void)
//CHECK-NEXT: -: 7:{
//CHECK-NEXT: 1: 8: func1();
//CHECK-NEXT: -: 9:
//CHECK-NEXT: 1: 10: execlp("ls", "-l", "-h", (char*)0);
//CHECK-NEXT: -: 11:
//CHECK-NEXT: #####: 12: func2();
//CHECK-NEXT: -: 13:
//CHECK-NEXT: #####: 14: return 0;
//CHECK-NEXT: -: 15:}

View File

@ -0,0 +1,17 @@
#include <unistd.h>
void func1() {}
void func2() {}
int main(void)
{
char *const args[] = {"-l", "-h", (char*)0};
func1();
execvp("ls", args);
func2();
return 0;
}

View File

@ -0,0 +1,25 @@
//CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-execvp.c
//CHECK-NEXT: -: 0:Graph:instrprof-gcov-execvp.gcno
//CHECK-NEXT: -: 0:Data:instrprof-gcov-execvp.gcda
//CHECK-NEXT: -: 0:Runs:1
//CHECK-NEXT: -: 0:Programs:1
//CHECK-NEXT: -: 1:#include <unistd.h>
//CHECK-NEXT: -: 2:
//CHECK-NEXT:function func1 called 1 returned 100% blocks executed 100%
//CHECK-NEXT: 1: 3:void func1() {}
//CHECK-NEXT:function func2 called 0 returned 0% blocks executed 0%
//CHECK-NEXT: #####: 4:void func2() {}
//CHECK-NEXT: -: 5:
//CHECK-NEXT:function main called 1 returned 0% blocks executed 33%
//CHECK-NEXT: 1: 6:int main(void)
//CHECK-NEXT: -: 7:{
//CHECK-NEXT: 1: 8: char *const args[] = {"-l", "-h", (char*)0};
//CHECK-NEXT: -: 9:
//CHECK-NEXT: 1: 10: func1();
//CHECK-NEXT: -: 11:
//CHECK-NEXT: 1: 12: execvp("ls", args);
//CHECK-NEXT: -: 13:
//CHECK-NEXT: #####: 14: func2();
//CHECK-NEXT: -: 15:
//CHECK-NEXT: #####: 16: return 0;
//CHECK-NEXT: -: 17:}

View File

@ -10,8 +10,8 @@
// CHECK-NEXT:function func2 called 2 returned 100% blocks executed 100%
// CHECK-NEXT: 2: 4:void func2() {}
// CHECK-NEXT: -: 5:
// CHECK-NEXT:function main called 1 returned 100% blocks executed 100%
// CHECK-NEXT: -: 6:int main(void)
// CHECK-NEXT:function main called 1 returned 200% blocks executed 100%
// CHECK-NEXT: 1: 6:int main(void)
// CHECK-NEXT: -: 7:{
// CHECK-NEXT: 1: 8: func1();
// CHECK-NEXT: -: 9:

View File

@ -0,0 +1,10 @@
RUN: mkdir -p %t.d
RUN: cd %t.d
RUN: %clang --coverage -o %t %S/../Inputs/instrprof-gcov-execlp.c
RUN: test -f instrprof-gcov-execlp.gcno
RUN: rm -f instrprof-gcov-execlp.gcda
RUN: %run %t
RUN: llvm-cov gcov -b -c instrprof-gcov-execlp.gcda
RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-execlp.c.gcov %S/../Inputs/instrprof-gcov-execlp.c.gcov

View File

@ -0,0 +1,10 @@
RUN: mkdir -p %t.d
RUN: cd %t.d
RUN: %clang --coverage -o %t %S/../Inputs/instrprof-gcov-execvp.c
RUN: test -f instrprof-gcov-execvp.gcno
RUN: rm -f instrprof-gcov-execvp.gcda
RUN: %run %t
RUN: llvm-cov gcov -b -c instrprof-gcov-execvp.gcda
RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-execvp.c.gcov %S/../Inputs/instrprof-gcov-execvp.c.gcov

View File

@ -1,5 +1,3 @@
XFAIL: *
RUN: mkdir -p %t.d
RUN: cd %t.d