Add sanity test for llvm-bolt

Test that instrumentation and optimization don't generate errors,
to prevent issues like https://bugzilla.redhat.com/show_bug.cgi?id=2344830.
This commit is contained in:
Nikita Popov 2025-02-11 10:08:54 +01:00 committed by nikic
commit d40ca8022a
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,15 @@
summary: Sanity check that llvm-bolt works
tier: 1
adjust+:
- because: "llvm-bolt is available for Fedora, not RHEL/CentOS"
when: distro != fedora
enabled: false
- because: "We only ship llvm-bolt in snapshots for fedora 41 and newer"
when: snapshot is defined and distro < fedora-41
enabled: false
require+:
- llvm-bolt
- clang

8
tests/bolt-sanity/test.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh -eux
echo "int main() { return 0; }" > test.c
clang -Wl,--emit-relocs test.c
llvm-bolt a.out -instrument -o a.instrumented.out
./a.instrumented.out
llvm-bolt a.out -data /tmp/prof.fdata -o a.bolt.out
./a.bolt.out