• Home
  • Raw
  • Download

Lines Matching +full:dependency +full:- +full:check

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 vm"
16 echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc"
17 echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc vm\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"
24 echo " failed the build dependency check from the TARGETS in Selftests"
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=$(egrep "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2)
96 if [ $# -eq 2 ]
115 l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
116 grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
121 # Some tests have multiple valid LDLIBS lines for individual sub-tests
122 # that need dependency checks. Find them and append them to the tests
123 # e.g: vm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
128 l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
129 grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
132 # memfd and others use pkg-config to find mount and fuse libs
133 # respectively and save it in VAR_LDLIBS. If pkg-config doesn't find
135 # Use the default value and filter out pkg-config for dependency check.
138 # VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
140 l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \
141 grep -v "pkg-config" | awk -F: '{print $1}')
172 test_libs=$(grep --include=Makefile "^LDLIBS" $test | \
173 grep -v "VAR_LDLIBS" | \
174 sed -e 's/\:/ /' | \
175 sed -e 's/+/ /' | cut -d "=" -f 2)
183 test_libs=$(grep --include=Makefile ": LDLIBS" $test | \
184 grep -v "VAR_LDLIBS" | \
185 sed -e 's/\:/ /' | sed -e 's/+/ /' | \
186 cut -d "=" -f 2)
193 test_libs=$(grep --include=Makefile "^VAR_LDLIBS" $test | \
194 grep -v "pkg-config" | sed -e 's/\:/ /' |
195 sed -e 's/+/ /' | cut -d "=" -f 2)
203 if [[ ! -z "${test_libs// }" ]]
211 $CC -o $tmp_file.bin $lib $tmp_file > /dev/null 2>&1
212 if [ $? -ne 0 ]; then
213 echo "FAIL: $test dependency check: $lib" >> $fail
216 fail_target=$(echo "$test" | cut -d "/" -f1)
218 targets=$(echo "$targets" | grep -v "$fail_target")
220 echo "PASS: $test dependency check passed $lib" >> $pass
223 pass_trgts+="$(echo "$test" | cut -d "/" -f1) "
232 echo -e "========================================================";
233 echo -e "Kselftest Dependency Check for [$0 $1 $2] results..."
235 if [ $print_targets -ne 0 ]
237 echo -e "Suggested Selftest Targets for your configuration:"
238 echo -e "$targets";
241 echo -e "========================================================";
242 echo -e "Checked tests defining LDLIBS dependencies"
243 echo -e "--------------------------------------------------------";
244 echo -e "Total tests with Dependencies:"
245 echo -e "$total_cnt Pass: $pass_cnt Fail: $fail_cnt";
247 if [ $pass_cnt -ne 0 ]; then
248 echo -e "--------------------------------------------------------";
250 echo -e "--------------------------------------------------------";
251 echo -e "Targets passed build dependency check on system:"
252 echo -e "$(echo "$pass_trgts" | xargs -n1 | sort -u | xargs)"
255 if [ $fail_cnt -ne 0 ]; then
256 echo -e "--------------------------------------------------------";
258 echo -e "--------------------------------------------------------";
259 echo -e "Targets failed build dependency check on system:"
260 echo -e "$(echo "$fail_trgts" | xargs -n1 | sort -u | xargs)"
261 echo -e "--------------------------------------------------------";
262 echo -e "Missing libraries system"
263 echo -e "$(echo "$fail_libs" | xargs -n1 | sort -u | xargs)"
266 echo -e "--------------------------------------------------------";
267 echo -e "========================================================";