tools/perf/tests/shell/buildid.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/buildid.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/buildid.sh- Extension
.sh- Size
- 7355 bytes
- Lines
- 327
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
Dependency Surface
stdlib.hsignal.hunistd.h
Detected Declarations
function sighandlerfunction main
Annotated Snippet
#!/bin/bash
# build id cache operations
# SPDX-License-Identifier: GPL-2.0
# skip if there's no readelf
if ! [ -x "$(command -v readelf)" ]; then
echo "failed: no readelf, install binutils"
exit 2
fi
# skip if there's no compiler
if ! [ -x "$(command -v cc)" ]; then
echo "failed: no compiler, install gcc"
exit 2
fi
# check what we need to test windows binaries
add_pe=1
run_pe=1
if ! perf version --build-options | grep -q 'libbfd: .* on '; then
echo "WARNING: perf not built with libbfd. PE binaries will not be tested."
add_pe=0
run_pe=0
fi
if ! which wine > /dev/null; then
echo "WARNING: wine not found. PE binaries will not be run."
run_pe=0
fi
# set up wine
if [ ${run_pe} -eq 1 ]; then
wineprefix=$(mktemp -d /tmp/perf.wineprefix.XXX)
export WINEPREFIX=${wineprefix}
# clear display variables to prevent wine from popping up dialogs
unset DISPLAY
unset WAYLAND_DISPLAY
fi
build_id_dir=
ex_source=$(mktemp /tmp/perf_buildid_test.ex.XXX.c)
ex_md5=$(mktemp /tmp/perf_buildid_test.ex.MD5.XXX)
ex_sha1=$(mktemp /tmp/perf_buildid_test.ex.SHA1.XXX)
ex_pe=$(dirname $0)/../pe-file.exe
data=$(mktemp /tmp/perf_buildid_test.data.XXX)
log_out=$(mktemp /tmp/perf_buildid_test.log.out.XXX)
log_err=$(mktemp /tmp/perf_buildid_test.log.err.XXX)
cleanup() {
rm -f ${ex_source} ${ex_md5} ${ex_sha1} ${data} ${log_out} ${log_err}
if [ ${run_pe} -eq 1 ]; then
rm -r ${wineprefix}
fi
if [ -d ${build_id_dir} ]; then
rm -rf ${build_id_dir}
fi
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
trap trap_cleanup EXIT TERM INT
# Test program based on the noploop workload.
cat <<EOF > ${ex_source}
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
Annotation
- Immediate include surface: `stdlib.h`, `signal.h`, `unistd.h`.
- Detected declarations: `function sighandler`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.