-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreltest
More file actions
executable file
·70 lines (59 loc) · 2.24 KB
/
reltest
File metadata and controls
executable file
·70 lines (59 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# Runs conformance tests and example scripts from a kernel tree root,
# bailing immediately if anything fails. For the examples that aren't
# tested by the test suite, we just confirm that they at least run.
#
# Should be run from the kernel root with $ Kconfiglib/tests/reltest
#
# Selftests (tests/test_*.py excluding test_conformance.py) should be run
# separately from the Kconfiglib project root:
# $ cd Kconfiglib && python -m pytest tests/ -v
test_script() {
echo -e "\n================= $1 with $py =================\n"
# Forward LD as a make command-line variable so it overrides the
# kernel Makefile's unconditional LD=$(CROSS_COMPILE)ld assignment.
# Environment variables alone do not override Makefile assignments.
local _ld_override=""
[ -n "${LD:-}" ] && _ld_override="LD=$LD"
if (($# == 1)); then
${MAKE:-make} $_ld_override scriptconfig PYTHONCMD=$py SCRIPT=$1
else
${MAKE:-make} $_ld_override scriptconfig PYTHONCMD=$py SCRIPT=$1 SCRIPT_ARG="$2"
fi
if (($?)); then
echo "$1 failed to run with $py"
exit 1
fi
}
if [ $# == "0" ]; then
py_execs="python3"
else
py_execs=$@
fi
kconfiglib_dir="$(cd "$(dirname "$0")/.." && pwd)"
for py in $py_execs; do
echo -e "\n================= Conformance tests with $py =================\n"
# Conformance tests run from the kernel root (cwd) where they compare
# output against the C Kconfig tools.
if ! $py -m pytest "$kconfiglib_dir/tests/test_conformance.py" -x -v --tb=short; then
echo "conformance tests failed for $py"
exit 1
fi
# Check that the example scripts that aren't tested by the test suite run
# at least
test_script Kconfiglib/examples/defconfig_oldconfig.py
test_script Kconfiglib/examples/eval_expr.py MODULES
test_script Kconfiglib/examples/find_symbol.py X86
test_script Kconfiglib/examples/help_grep.py general
test_script Kconfiglib/examples/print_sym_info.py MODULES
test_script Kconfiglib/examples/print_tree.py
$py Kconfiglib/examples/menuconfig_example.py Kconfiglib/examples/Kmenuconfig <<END
BOOL
n
END
if (($?)); then
echo "menuconfig_example.py failed with $py"
exit 1
fi
done
echo "everything okay"