Lines Matching +full:e +full:- +full:fuse
2 # SPDX-License-Identifier: GPL-2.0
13 echo -e "Usage: $0 -[p] <compiler> [test_name]\n"
14 echo -e "\tkselftest_deps.sh [-p] gcc"
15 echo -e "\tkselftest_deps.sh [-p] gcc mm"
16 echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc"
17 echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc mm\n"
18 echo "- Should be run in selftests directory in the kernel repo."
19 echo "- Checks if Kselftests can be built/cross-built on a system."
20 echo "- Parses all test/sub-test Makefile to find library dependencies."
21 echo "- Runs compile test on a trivial C file with LDLIBS specified"
23 echo "- Prints suggested target list for a system filtering out tests"
25 echo " main Makefile when optional -p is specified."
26 echo "- Prints pass/fail dependency check for each tests/sub-test."
27 echo "- Prints pass/fail targets and libraries."
28 echo "- Default: runs dependency checks on all tests."
29 echo "- Optional: test name can be specified to check dependencies for it."
39 # Make sure we're in the selftests top-level directory.
41 echo -e "\tPlease run $0 in"
42 echo -e "\ttools/testing/selftests directory ..."
56 if [ $# -eq 0 ]
65 trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT
69 trap "rm -f $pass" EXIT
73 trap "rm -f $fail" EXIT
93 targets=$(grep -E "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2)
97 filter="\$(VAR_LDLIBS)\|pkg-config\|PKG_CONFIG\|IOURING_EXTRA_LIBS"
100 if [ $# -eq 2 ]
121 l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
122 grep -v "$filter" | awk -F: '{print $1}' | uniq)
127 # Some tests have multiple valid LDLIBS lines for individual sub-tests
129 # e.g: mm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
134 l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
135 grep -v "$filter" | awk -F: '{print $1}' | uniq)
138 # memfd and others use pkg-config to find mount and fuse libs
139 # respectively and save it in VAR_LDLIBS. If pkg-config doesn't find
141 # Use the default value and filter out pkg-config for dependency check.
142 # e.g:
144 # VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
146 l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \
147 grep -v "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq)
150 # some tests may fall back to default using `|| echo -l<libname>`
151 # if pkg-config doesn't find the libs, instead of using VAR_LDLIBS
153 # e.g:
155 # LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
156 l4_tests=$(grep -r --include=Makefile "^LDLIBS" | \
157 grep "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq)
161 # which in turn may be defined in a sub-Makefile
162 # e.g.:
165 l5_tests=$(grep -r --include=Makefile "LDLIBS +=.*\$(IOURING_EXTRA_LIBS)" | \
166 awk -F: '{print $1}' | uniq)
207 test_libs=$(grep --include=Makefile "^LDLIBS" $test | \
208 grep -v "$filter" | \
209 sed -e 's/\:/ /' | \
210 sed -e 's/+/ /' | cut -d "=" -f 2)
218 test_libs=$(grep --include=Makefile ": LDLIBS" $test | \
219 grep -v "$filter" | \
220 sed -e 's/\:/ /' | sed -e 's/+/ /' | \
221 cut -d "=" -f 2)
228 test_libs=$(grep --include=Makefile "^VAR_LDLIBS" $test | \
229 grep -v "pkg-config" | sed -e 's/\:/ /' |
230 sed -e 's/+/ /' | cut -d "=" -f 2)
237 test_libs=$(grep --include=Makefile "^VAR_LDLIBS\|^LDLIBS" $test | \
238 grep "\(pkg-config\|PKG_CONFIG\).*|| echo " | \
239 sed -e 's/.*|| echo //' | sed -e 's/)$//')
246 tests=$(find $(dirname "$test") -type f -name "*.mk")
247 [[ -z "${tests// }" ]] && return
249 cut -d "=" -f 2)
257 if [[ ! -z "${test_libs// }" ]]
265 $CC -o $tmp_file.bin $lib $tmp_file > /dev/null 2>&1
266 if [ $? -ne 0 ]; then
270 fail_target=$(echo "$test" | cut -d "/" -f1)
272 targets=$(echo "$targets" | grep -v "$fail_target")
277 pass_trgts+="$(echo "$test" | cut -d "/" -f1) "
286 echo -e "========================================================";
287 echo -e "Kselftest Dependency Check for [$0 $1 $2] results..."
289 if [ $print_targets -ne 0 ]
291 echo -e "Suggested Selftest Targets for your configuration:"
292 echo -e "$targets";
295 echo -e "========================================================";
296 echo -e "Checked tests defining LDLIBS dependencies"
297 echo -e "--------------------------------------------------------";
298 echo -e "Total tests with Dependencies:"
299 echo -e "$total_cnt Pass: $pass_cnt Fail: $fail_cnt";
301 if [ $pass_cnt -ne 0 ]; then
302 echo -e "--------------------------------------------------------";
304 echo -e "--------------------------------------------------------";
305 echo -e "Targets passed build dependency check on system:"
306 echo -e "$(echo "$pass_trgts" | xargs -n1 | sort -u | xargs)"
309 if [ $fail_cnt -ne 0 ]; then
310 echo -e "--------------------------------------------------------";
312 echo -e "--------------------------------------------------------";
313 echo -e "Targets failed build dependency check on system:"
314 echo -e "$(echo "$fail_trgts" | xargs -n1 | sort -u | xargs)"
315 echo -e "--------------------------------------------------------";
316 echo -e "Missing libraries system"
317 echo -e "$(echo "$fail_libs" | xargs -n1 | sort -u | xargs)"
320 echo -e "--------------------------------------------------------";
321 echo -e "========================================================";