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

Elvina Yakubova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 12:40:05 PDT 2023


Elvina created this revision.
Elvina added reviewers: maksfb, Amir, rafauler, yota9.
Herald added subscribers: treapster, ayermolo.
Herald added a project: All.
Elvina requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Tests for instrumentation


Repository:
  rG LLVM Github Monorepo

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
  bolt/test/runtime/X86/instrumentation-indirect.c
  bolt/test/runtime/X86/instrumentation-pie.c
  bolt/test/runtime/X86/instrumentation-shlib.c
  bolt/test/runtime/instrumentation-indirect.c
  bolt/test/runtime/instrumentation-pie.c
  bolt/test/runtime/instrumentation-shlib.c


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,7 +1,7 @@
 /**
  * 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151920.527565.patch
Type: text/x-patch
Size: 2869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230601/18a84108/attachment.bin>


More information about the llvm-commits mailing list