Advertisement
Guest User

Untitled

a guest
Jun 27th, 2023
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. /*
  2. REQUIRES: system-linux
  3.  
  4. RUN: %clang %cflags %s -o %t.exe -Wl,-q -pie -fpie
  5.  
  6. RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata \
  7. RUN: --conservative-instrumentation -o %t.instrumented_conservative
  8.  
  9. # Instrumented program needs to finish returning zero
  10. # Both output and profile must contain all 16 functions
  11. RUN: %t.instrumented_conservative | FileCheck %s --check-prefix=CHECK-CHILD
  12. RUN: %t.instrumented_conservative | FileCheck %s --check-prefix=CHECK-PARENT
  13. RUN: cat %t.fdata | FileCheck %s --check-prefix=CHECK-CHILD
  14. RUN: cat %t.fdata | FileCheck %s --check-prefix=CHECK-PARENT
  15.  
  16. RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t \
  17. RUN: --instrumentation-file-append-pid \
  18. RUN: -o %t.instrumented
  19.  
  20. RUN: %t.instrumented > %t.output
  21. # Make sure all functions were called
  22. RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-CHILD
  23. RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-PARENT
  24.  
  25. RUN: child_pid=$(cat %t.output | grep funcA | awk '{print $2;}')
  26. RUN: par_pid=$(cat %t.output | grep funcB | awk '{print $2;}')
  27. RUN: mv %t.$child_pid.fdata %t.child.fdata
  28. RUN: mv %t.$par_pid.fdata %t.parent.fdata
  29.  
  30. # Instrumented binary must produce two profiles with only local calls
  31. # recorded. Functions called only in child should not appear in parent's
  32. # process and vice versa.
  33. RUN: cat %t.child.fdata | FileCheck %s --check-prefix=CHECK-CHILD
  34. RUN: cat %t.child.fdata | FileCheck %s --check-prefix=CHECK-NOPARENT
  35. RUN: cat %t.parent.fdata | FileCheck %s --check-prefix=CHECK-PARENT
  36. RUN: cat %t.parent.fdata | FileCheck %s --check-prefix=CHECK-NOCHILD
  37.  
  38. CHECK-CHILD: funcA
  39. CHECK-CHILD: funcC
  40. CHECK-CHILD: funcE
  41. CHECK-CHILD: funcG
  42. CHECK-CHILD: funcI
  43. CHECK-CHILD: funcK
  44. CHECK-CHILD: funcM
  45. CHECK-CHILD: funcO
  46.  
  47. CHECK-NOCHILD-NOT: funcA
  48. CHECK-NOCHILD-NOT: funcC
  49. CHECK-NOCHILD-NOT: funcE
  50. CHECK-NOCHILD-NOT: funcG
  51. CHECK-NOCHILD-NOT: funcI
  52. CHECK-NOCHILD-NOT: funcK
  53. CHECK-NOCHILD-NOT: funcM
  54. CHECK-NOCHILD-NOT: funcO
  55.  
  56. CHECK-PARENT: funcB
  57. CHECK-PARENT: funcD
  58. CHECK-PARENT: funcF
  59. CHECK-PARENT: funcH
  60. CHECK-PARENT: funcJ
  61. CHECK-PARENT: funcL
  62. CHECK-PARENT: funcN
  63. CHECK-PARENT: funcP
  64.  
  65. CHECK-NOPARENT-NOT: funcB
  66. CHECK-NOPARENT-NOT: funcD
  67. CHECK-NOPARENT-NOT: funcF
  68. CHECK-NOPARENT-NOT: funcH
  69. CHECK-NOPARENT-NOT: funcJ
  70. CHECK-NOPARENT-NOT: funcL
  71. CHECK-NOPARENT-NOT: funcN
  72. CHECK-NOPARENT-NOT: funcP
  73.  
  74. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement