[PATCH] D151920: [BOLT] Instrumentation: Fix tests

Elvina Yakubova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 13:42:48 PDT 2023


Elvina updated this revision to Diff 527951.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151920/new/

https://reviews.llvm.org/D151920

Files:
  bolt/test/X86/asm-dump.c
  bolt/test/X86/bolt-address-translation-internal-call.test
  bolt/test/X86/internal-call-instrument.s
  bolt/test/runtime/AArch64/Inputs/basic-instrumentation.s
  bolt/test/runtime/AArch64/basic-instrumentation.test


Index: bolt/test/runtime/AArch64/basic-instrumentation.test
===================================================================
--- /dev/null
+++ bolt/test/runtime/AArch64/basic-instrumentation.test
@@ -0,0 +1,22 @@
+# Try to instrument a very fast test. Input bin will not execute any code during
+# runtime besides returning zero in main, so it is a good trivial case.
+REQUIRES: system-linux,bolt-runtime
+
+RUN: %clang %p/Inputs/basic-instrumentation.s -Wl,-q -o %t.exe
+RUN: llvm-bolt %t.exe -o %t --instrument \
+RUN:   --instrumentation-file=%t \
+RUN:   --instrumentation-file-append-pid
+
+# Execute program to collect profile
+RUN: rm %t.*.fdata || echo Nothing to remove
+RUN: %t
+
+# Profile should be written to %t.PID.fdata, check it
+RUN: mv %t.*.fdata %t.fdata
+RUN: cat %t.fdata | FileCheck -check-prefix=CHECK %s
+
+# Check BOLT works with this profile
+RUN: llvm-bolt %t.exe --data %t.fdata -o %t.2 --reorder-blocks=cache
+
+# The instrumented profile should at least say main was called once
+CHECK: main 0 0 1{{$}}
Index: bolt/test/runtime/AArch64/Inputs/basic-instrumentation.s
===================================================================
--- /dev/null
+++ bolt/test/runtime/AArch64/Inputs/basic-instrumentation.s
@@ -0,0 +1,9 @@
+  .globl main
+  .type main, %function
+main:
+	sub		sp, sp, #16
+	mov		w0, wzr
+	str		wzr, [sp, #12]
+	add		sp, sp, #16
+	ret
+.size main, .-main
Index: bolt/test/X86/internal-call-instrument.s
===================================================================
--- bolt/test/X86/internal-call-instrument.s
+++ bolt/test/X86/internal-call-instrument.s
@@ -1,6 +1,6 @@
 # This reproduces a bug with instrumentation crashes on internal call
 
-# REQUIRES: system-linux,bolt-runtime
+# REQUIRES: x86_64-linux,bolt-runtime
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
 # Delete our BB symbols so BOLT doesn't mark them as entry points
Index: bolt/test/X86/bolt-address-translation-internal-call.test
===================================================================
--- bolt/test/X86/bolt-address-translation-internal-call.test
+++ bolt/test/X86/bolt-address-translation-internal-call.test
@@ -4,7 +4,7 @@
 # internal calls) might create new blocks without a mapping to an
 # input block.
 
-# REQUIRES: system-linux,bolt-runtime
+# REQUIRES: x86_64-linux,bolt-runtime
 
 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
 # Delete our BB symbols so BOLT doesn't mark them as entry points
Index: bolt/test/X86/asm-dump.c
===================================================================
--- bolt/test/X86/asm-dump.c
+++ bolt/test/X86/asm-dump.c
@@ -1,13 +1,14 @@
 /**
  * Test for asm-dump functionality.
  *
- * REQUIRES: system-linux,bolt-runtime
+ * REQUIRES: x86_64-linux,bolt-runtime
  *
  * Compile the source
  * RUN: %clang -fPIC %s -o %t.exe -Wl,-q
  *
  * Profile collection: instrument the binary
- * RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata -o %t.instr
+ * RUN: llvm-bolt %t.exe --instrument --instrumentation-file=%t.fdata -o
+ * %t.instr
  *
  * Profile collection: run instrumented binary (and capture output)
  * RUN: %t.instr > %t.result


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151920.527951.patch
Type: text/x-patch
Size: 3192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230602/71b785fc/attachment.bin>


More information about the llvm-commits mailing list