Debian Codegraph @

tests/reltest

raw
1 #!/usr/bin/env bash
2
3 # Runs the test suite and all examples scripts with Python 2 and Python 3,
4 # bailing immediately if anything fails. For the examples that aren't tested in
5 # the test suite, we just confirm that they at least run.
6 #
7 # Should be run from the kernel root with $ Kconfiglib/tests/reltest
8
9 test_script() {
10 echo -e "\n================= $1 with $py =================\n"
11 if (($# == 1)); then
12 make scriptconfig PYTHONCMD=$py SCRIPT=$1
13 else
14 make scriptconfig PYTHONCMD=$py SCRIPT=$1 SCRIPT_ARG="$2"
15 fi
16
17 if (($?)); then
18 echo "$1 failed to run with $py"
19 exit 1
20 fi
21 }
22
23 for py in python2 python3; do
24 echo -e "\n================= Test suite with $py =================\n"
25
26 if ! $py Kconfiglib/testsuite.py; then
27 echo "test suite failed for $py"
28 exit 1
29 fi
30
31 # Check that the example scripts that aren't tested by the test suite run
32 # at least
33
34 test_script Kconfiglib/examples/defconfig_oldconfig.py
35 test_script Kconfiglib/examples/eval_expr.py MODULES
36 test_script Kconfiglib/examples/find_symbol.py X86
37 test_script Kconfiglib/examples/help_grep.py general
38 test_script Kconfiglib/examples/print_sym_info.py MODULES
39 test_script Kconfiglib/examples/print_tree.py
40
41 $py Kconfiglib/examples/menuconfig_example.py Kconfiglib/examples/Kmenuconfig <<END
42 BOOL
43 n
44 END
45 if (($?)); then
46 echo "menuconfig_example.py failed with $py"
47 exit 1
48 fi
49 done
50
51 echo "everything okay"