^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #!/bin/bash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # kselftest_deps.sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) # Checks for kselftest build dependencies on the build system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # Copyright (c) 2020 Shuah Khan <skhan@linuxfoundation.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) usage()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) echo -e "Usage: $0 -[p] <compiler> [test_name]\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) echo -e "\tkselftest_deps.sh [-p] gcc"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) echo -e "\tkselftest_deps.sh [-p] gcc vm"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc vm\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) echo "- Should be run in selftests directory in the kernel repo."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) echo "- Checks if Kselftests can be built/cross-built on a system."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) echo "- Parses all test/sub-test Makefile to find library dependencies."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) echo "- Runs compile test on a trivial C file with LDLIBS specified"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) echo " in the test Makefiles to identify missing library dependencies."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) echo "- Prints suggested target list for a system filtering out tests"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) echo " failed the build dependency check from the TARGETS in Selftests"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) echo " main Makefile when optional -p is specified."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) echo "- Prints pass/fail dependency check for each tests/sub-test."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) echo "- Prints pass/fail targets and libraries."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) echo "- Default: runs dependency checks on all tests."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) echo "- Optional test name can be specified to check dependencies for it."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) # Start main()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) main()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) base_dir=`pwd`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) # Make sure we're in the selftests top-level directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) if [ $(basename "$base_dir") != "selftests" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) echo -e "\tPlease run $0 in"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) echo -e "\ttools/testing/selftests directory ..."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) print_targets=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) while getopts "p" arg; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) case $arg in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) print_targets=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) shift;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if [ $# -eq 0 ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) # Compiler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) CC=$1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) tmp_file=$(mktemp).c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #echo $tmp_file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) pass=$(mktemp).out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) trap "rm -f $pass" EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #echo $pass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) fail=$(mktemp).out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) trap "rm -f $fail" EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #echo $fail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) # Generate tmp source fire for compile test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) cat << "EOF" > $tmp_file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) int main()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) # Save results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) total_cnt=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) fail_trgts=()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) fail_libs=()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) fail_cnt=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) pass_trgts=()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) pass_libs=()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) pass_cnt=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) # Get all TARGETS from selftests Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) targets=$(egrep "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) # Single test case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) if [ $# -eq 2 ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) test=$2/Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) l1_test $test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) l2_test $test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) l3_test $test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) print_results $1 $2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) exit $?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) # Level 1: LDLIBS set static.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) # Find all LDLIBS set statically for all executables built by a Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) # and filter out VAR_LDLIBS to discard the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) # gpio/Makefile:LDLIBS += $(VAR_LDLIBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) # Append space at the end of the list to append more tests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) # Level 2: LDLIBS set dynamically.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) # Level 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) # Some tests have multiple valid LDLIBS lines for individual sub-tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) # that need dependency checks. Find them and append them to the tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) # e.g: vm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) # Filter out VAR_LDLIBS to discard the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) # memfd/Makefile:$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) # Append space at the end of the list to append more tests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) # Level 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) # gpio, memfd and others use pkg-config to find mount and fuse libs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) # respectively and save it in VAR_LDLIBS. If pkg-config doesn't find
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) # any, VAR_LDLIBS set to default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) # Use the default value and filter out pkg-config for dependency check.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) # e.g:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) # gpio/Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) # VAR_LDLIBS := $(shell pkg-config --libs mount) 2>/dev/null)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) # memfd/Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) # VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) grep -v "pkg-config" | awk -F: '{print $1}')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #echo $l1_tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #echo $l2_1_tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #echo $l3_tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) all_tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) print_results $1 $2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) exit $?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) # end main()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) all_tests()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) for test in $l1_tests; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) l1_test $test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) for test in $l2_tests; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) l2_test $test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) for test in $l3_tests; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) l3_test $test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) # Use same parsing used for l1_tests and pick libraries this time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) l1_test()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) test_libs=$(grep --include=Makefile "^LDLIBS" $test | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) grep -v "VAR_LDLIBS" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) sed -e 's/\:/ /' | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) sed -e 's/+/ /' | cut -d "=" -f 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) check_libs $test $test_libs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) # Use same parsing used for l2__tests and pick libraries this time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) l2_test()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) test_libs=$(grep --include=Makefile ": LDLIBS" $test | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) grep -v "VAR_LDLIBS" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) sed -e 's/\:/ /' | sed -e 's/+/ /' | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) cut -d "=" -f 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) check_libs $test $test_libs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) l3_test()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) test_libs=$(grep --include=Makefile "^VAR_LDLIBS" $test | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) grep -v "pkg-config" | sed -e 's/\:/ /' |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) sed -e 's/+/ /' | cut -d "=" -f 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) check_libs $test $test_libs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) check_libs()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if [[ ! -z "${test_libs// }" ]]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) #echo $test_libs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) for lib in $test_libs; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) let total_cnt+=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) $CC -o $tmp_file.bin $lib $tmp_file > /dev/null 2>&1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if [ $? -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) echo "FAIL: $test dependency check: $lib" >> $fail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) let fail_cnt+=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) fail_libs+="$lib "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) fail_target=$(echo "$test" | cut -d "/" -f1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) fail_trgts+="$fail_target "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) targets=$(echo "$targets" | grep -v "$fail_target")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) echo "PASS: $test dependency check passed $lib" >> $pass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) let pass_cnt+=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) pass_libs+="$lib "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) pass_trgts+="$(echo "$test" | cut -d "/" -f1) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) print_results()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) echo -e "========================================================";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) echo -e "Kselftest Dependency Check for [$0 $1 $2] results..."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) if [ $print_targets -ne 0 ]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) echo -e "Suggested Selftest Targets for your configuration:"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) echo -e "$targets";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) echo -e "========================================================";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) echo -e "Checked tests defining LDLIBS dependencies"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) echo -e "Total tests with Dependencies:"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) echo -e "$total_cnt Pass: $pass_cnt Fail: $fail_cnt";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) if [ $pass_cnt -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) cat $pass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) echo -e "Targets passed build dependency check on system:"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) echo -e "$(echo "$pass_trgts" | xargs -n1 | sort -u | xargs)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) if [ $fail_cnt -ne 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) cat $fail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) echo -e "Targets failed build dependency check on system:"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) echo -e "$(echo "$fail_trgts" | xargs -n1 | sort -u | xargs)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) echo -e "Missing libraries system"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) echo -e "$(echo "$fail_libs" | xargs -n1 | sort -u | xargs)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) echo -e "--------------------------------------------------------";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) echo -e "========================================================";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) main "$@"