mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-15 23:46:07 +07:00
93a4388b76
Add build/cross-build dependency check script kselftest_deps.sh This script does the following: Usage: ./kselftest_deps.sh -[p] <compiler> [test_name] kselftest_deps.sh [-p] gcc kselftest_deps.sh [-p] gcc vm kselftest_deps.sh [-p] aarch64-linux-gnu-gcc kselftest_deps.sh [-p] aarch64-linux-gnu-gcc vm - Should be run in selftests directory in the kernel repo. - Checks if Kselftests can be built/cross-built on a system. - Parses all test/sub-test Makefile to find library dependencies. - Runs compile test on a trivial C file with LDLIBS specified in the test Makefiles to identify missing library dependencies. - Prints suggested target list for a system filtering out tests failed the build dependency check from the TARGETS in Selftests the main Makefile when optional -p is specified. - Prints pass/fail dependency check for each tests/sub-test. - Prints pass/fail targets and libraries. - Default: runs dependency checks on all tests. - Optional test name can be specified to check dependencies for it. To make LDLIBS parsing easier - change gpio and memfd Makefiles to use the same temporary variable used to find and add libraries to LDLIBS. - simlify LDLIBS append logic in intel_pstate/Makefile. Results from run on x86_64 system (trimmed detailed pass/fail list): ======================================================== Kselftest Dependency Check for [./kselftest_deps.sh gcc ] results... ======================================================== Checked tests defining LDLIBS dependencies -------------------------------------------------------- Total tests with Dependencies: 55 Pass: 53 Fail: 2 -------------------------------------------------------- Targets passed build dependency check on system: bpf capabilities filesystems futex gpio intel_pstate membarrier memfd mqueue net powerpc ptp rseq rtc safesetid timens timers vDSO vm -------------------------------------------------------- FAIL: netfilter/Makefile dependency check: -lmnl FAIL: gpio/Makefile dependency check: -lmount -------------------------------------------------------- Targets failed build dependency check on system: gpio netfilter -------------------------------------------------------- Missing libraries system -lmnl -lmount -------------------------------------------------------- ======================================================== Results from run on x86_64 system with aarch64-linux-gnu-gcc: (trimmed detailed pass/fail list): ======================================================== Kselftest Dependency Check for [./kselftest_deps.sh aarch64-linux-gnu-gcc ] results... ======================================================== Checked tests defining LDLIBS dependencies -------------------------------------------------------- Total tests with Dependencies: 55 Pass: 41 Fail: 14 -------------------------------------------------------- Targets failed build dependency check on system: bpf capabilities filesystems futex gpio intel_pstate membarrier memfd mqueue net powerpc ptp rseq rtc timens timers vDSO vm -------------------------------------------------------- -------------------------------------------------------- Targets failed build dependency check on system: bpf capabilities gpio memfd mqueue net netfilter safesetid vm -------------------------------------------------------- Missing libraries system -lcap -lcap-ng -lelf -lfuse -lmnl -lmount -lnuma -lpopt -lz -------------------------------------------------------- ======================================================== Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
33 lines
791 B
Makefile
33 lines
791 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
VAR_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
|
|
VAR_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
|
|
ifeq ($(VAR_LDLIBS),)
|
|
VAR_LDLIBS := -lmount -I/usr/include/libmount
|
|
endif
|
|
|
|
CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(VAR_CFLAGS)
|
|
LDLIBS += $(VAR_LDLIBS)
|
|
|
|
TEST_PROGS := gpio-mockup.sh
|
|
TEST_FILES := gpio-mockup-sysfs.sh
|
|
TEST_PROGS_EXTENDED := gpio-mockup-chardev
|
|
|
|
GPIODIR := $(realpath ../../../gpio)
|
|
GPIOOBJ := gpio-utils.o
|
|
|
|
all: $(TEST_PROGS_EXTENDED)
|
|
|
|
override define CLEAN
|
|
$(RM) $(TEST_PROGS_EXTENDED)
|
|
$(MAKE) -C $(GPIODIR) OUTPUT=$(GPIODIR)/ clean
|
|
endef
|
|
|
|
KSFT_KHDR_INSTALL := 1
|
|
include ../lib.mk
|
|
|
|
$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
|
|
|
|
$(GPIODIR)/$(GPIOOBJ):
|
|
$(MAKE) OUTPUT=$(GPIODIR)/ -C $(GPIODIR)
|