Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- REQUIRES: system-linux
- RUN: %clang %cflags %s -o %t.exe -Wl,-q -pie -fpie
- RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata \
- RUN: --conservative-instrumentation -o %t.instrumented_conservative
- # Instrumented program needs to finish returning zero
- # Both output and profile must contain all 16 functions
- RUN: %t.instrumented_conservative | FileCheck %s --check-prefix=CHECK-CHILD
- RUN: %t.instrumented_conservative | FileCheck %s --check-prefix=CHECK-PARENT
- RUN: cat %t.fdata | FileCheck %s --check-prefix=CHECK-CHILD
- RUN: cat %t.fdata | FileCheck %s --check-prefix=CHECK-PARENT
- RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t \
- RUN: --instrumentation-file-append-pid \
- RUN: -o %t.instrumented
- RUN: %t.instrumented > %t.output
- # Make sure all functions were called
- RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-CHILD
- RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-PARENT
- RUN: child_pid=$(cat %t.output | grep funcA | awk '{print $2;}')
- RUN: par_pid=$(cat %t.output | grep funcB | awk '{print $2;}')
- RUN: mv %t.$child_pid.fdata %t.child.fdata
- RUN: mv %t.$par_pid.fdata %t.parent.fdata
- # Instrumented binary must produce two profiles with only local calls
- # recorded. Functions called only in child should not appear in parent's
- # process and vice versa.
- RUN: cat %t.child.fdata | FileCheck %s --check-prefix=CHECK-CHILD
- RUN: cat %t.child.fdata | FileCheck %s --check-prefix=CHECK-NOPARENT
- RUN: cat %t.parent.fdata | FileCheck %s --check-prefix=CHECK-PARENT
- RUN: cat %t.parent.fdata | FileCheck %s --check-prefix=CHECK-NOCHILD
- CHECK-CHILD: funcA
- CHECK-CHILD: funcC
- CHECK-CHILD: funcE
- CHECK-CHILD: funcG
- CHECK-CHILD: funcI
- CHECK-CHILD: funcK
- CHECK-CHILD: funcM
- CHECK-CHILD: funcO
- CHECK-NOCHILD-NOT: funcA
- CHECK-NOCHILD-NOT: funcC
- CHECK-NOCHILD-NOT: funcE
- CHECK-NOCHILD-NOT: funcG
- CHECK-NOCHILD-NOT: funcI
- CHECK-NOCHILD-NOT: funcK
- CHECK-NOCHILD-NOT: funcM
- CHECK-NOCHILD-NOT: funcO
- CHECK-PARENT: funcB
- CHECK-PARENT: funcD
- CHECK-PARENT: funcF
- CHECK-PARENT: funcH
- CHECK-PARENT: funcJ
- CHECK-PARENT: funcL
- CHECK-PARENT: funcN
- CHECK-PARENT: funcP
- CHECK-NOPARENT-NOT: funcB
- CHECK-NOPARENT-NOT: funcD
- CHECK-NOPARENT-NOT: funcF
- CHECK-NOPARENT-NOT: funcH
- CHECK-NOPARENT-NOT: funcJ
- CHECK-NOPARENT-NOT: funcL
- CHECK-NOPARENT-NOT: funcN
- CHECK-NOPARENT-NOT: funcP
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement