diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-17 12:14:31 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-09 19:53:44 -0400 |
commit | d666b61311bd33301afcd8f7539454d7c867d20c (patch) | |
tree | d3ef1f5de5d8b18ef102261228dfa750cab44125 | |
parent | 6bd5ed8a1b58b81b91b9088b7b7aa6b08ff0bff0 (diff) |
Convert bools to normal shell style
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rwxr-xr-x | ci/test-git-branch.sh | 2 | ||||
-rw-r--r-- | lib/common.sh | 14 | ||||
-rw-r--r-- | lib/libktest.sh | 32 | ||||
-rw-r--r-- | lib/parse-test.sh | 2 | ||||
-rwxr-xr-x | lib/testrunner | 10 | ||||
-rw-r--r-- | tests/kconfig.sh | 2 | ||||
-rw-r--r-- | tests/prelude.sh | 2 |
7 files changed, 32 insertions, 32 deletions
diff --git a/ci/test-git-branch.sh b/ci/test-git-branch.sh index 9517c17..72148f8 100755 --- a/ci/test-git-branch.sh +++ b/ci/test-git-branch.sh @@ -4,7 +4,7 @@ set -o nounset set -o errexit set -o errtrace -ktest_verbose=1 +ktest_verbose=false ktest_verbosearg="" ktest_once=false diff --git a/lib/common.sh b/lib/common.sh index 939cecb..7786091 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -29,7 +29,7 @@ get_tmpdir() log_verbose() { - if [[ $ktest_verbose != 0 ]]; then + if $ktest_verbose; then echo "$@" fi } @@ -39,7 +39,12 @@ run_quiet() local msg=$1 shift - if [[ $ktest_verbose = 0 ]]; then + if $ktest_verbose; then + if [[ -n $msg ]]; then + echo "$msg:" + fi + "$@" + else if [[ -n $msg ]]; then echo -n "$msg... " fi @@ -61,11 +66,6 @@ run_quiet() if [[ -n $msg ]]; then echo done fi - else - if [[ -n $msg ]]; then - echo "$msg:" - fi - "$@" fi } diff --git a/lib/libktest.sh b/lib/libktest.sh index ff6f08e..95d4b77 100644 --- a/lib/libktest.sh +++ b/lib/libktest.sh @@ -15,14 +15,14 @@ ktest_root_image="" # virtual machine root filesystem ktest_out="./ktest-out" # dir for test output (logs, code coverage, etc.) ktest_priority=0 # hint for how long test should run -ktest_interactive=0 # if set to 1, timeout is ignored completely +ktest_interactive=false # if set to true, timeout is ignored completely # sets with: -I ktest_exit_on_success=0 # if true, exit on success, not failure or timeout ktest_failfast=false -ktest_loop=0 -ktest_verbose=0 # if false, append quiet to kernel commad line -ktest_crashdump=0 -ktest_kgdb=0 +ktest_loop=false +ktest_verbose=false # if false, append quiet to kernel commad line +ktest_crashdump=false +ktest_kgdb=false ktest_ssh_port=0 ktest_networking=user ktest_dio=off @@ -57,7 +57,7 @@ parse_ktest_arg() ktest_priority=$OPTARG ;; I) - ktest_interactive=1 + ktest_interactive=true ;; S) ktest_exit_on_success=1 @@ -66,10 +66,10 @@ parse_ktest_arg() ktest_failfast=true ;; L) - ktest_loop=1 + ktest_loop=true ;; v) - ktest_verbose=1 + ktest_verbose=true ;; x) set -x @@ -90,10 +90,10 @@ parse_args_post() ktest_out=$(readlink -f "$ktest_out") ktest_kernel_binary="$ktest_out/kernel.$ktest_arch" - if [[ $ktest_interactive = 1 ]]; then - ktest_kgdb=1 + if $ktest_interactive; then + ktest_kgdb=true else - ktest_crashdump=1 + ktest_crashdump=true fi if [[ $ktest_nice != 0 ]]; then @@ -158,8 +158,8 @@ ktest_run() ktest_boot() { - ktest_interactive=1 - ktest_kgdb=1 + ktest_interactive=true + ktest_kgdb=true ktest_run "$ktest_dir/boot.ktest" "$@" } @@ -299,9 +299,9 @@ start_vm() kernelargs+=(mitigations=off) kernelargs+=("ktest.dir=$ktest_dir") kernelargs+=(ktest.env=$(readlink -f "$ktest_out/vm/env")) - [[ $ktest_kgdb = 1 ]] && kernelargs+=(kgdboc=ttyS0,115200 nokaslr) - [[ $ktest_verbose = 0 ]] && kernelargs+=(quiet systemd.show_status=0 systemd.log-target=null) - [[ $ktest_crashdump = 1 ]] && kernelargs+=(crashkernel=128M) + $ktest_kgdb && kernelargs+=(kgdboc=ttyS0,115200 nokaslr) + $ktest_verbose || kernelargs+=(quiet systemd.show_status=0 systemd.log-target=null) + $ktest_crashdump && kernelargs+=(crashkernel=128M) kernelargs+=("${ktest_kernel_append[@]}") diff --git a/lib/parse-test.sh b/lib/parse-test.sh index 3f37517..419cf57 100644 --- a/lib/parse-test.sh +++ b/lib/parse-test.sh @@ -1,7 +1,7 @@ parse_test_deps() { - #export ktest_crashdump + export ktest_crashdump eval $("$ktest_test" deps) parse_arch "$ktest_arch" diff --git a/lib/testrunner b/lib/testrunner index 7d1ec5a..acbc45f 100755 --- a/lib/testrunner +++ b/lib/testrunner @@ -60,9 +60,9 @@ fi # If debugging crash dumps, add "console=hvc0" to the append line # below: -if [[ $ktest_crashdump = 1 ]]; then - kexec -p /host/$ktest_kernel_binary/vmlinuz --append="root=$ktest_root_dev rw maxcpus=1" || true -fi +#if $ktest_crashdump; then +# kexec -p /host/$ktest_kernel_binary/vmlinuz --append="root=$ktest_root_dev rw maxcpus=1" || true +#fi NR_REBOOTS=0 EXPECTED_REBOOT=0 @@ -177,8 +177,8 @@ while [[ $ret = 0 ]]; do /host/$ktest_test run-tests $ktest_tests ret=$? pkill -P $$ >/dev/null || true - [[ $ret != 0 ]] && break - [[ $ktest_loop = 1 ]] || break + [[ $ret != 0 ]] && break + $ktest_loop || break iterations=$((iterations + 1)) echo "SUCCESSFUL ITERATIONS $iterations" diff --git a/tests/kconfig.sh b/tests/kconfig.sh index 3b15699..efd24f3 100644 --- a/tests/kconfig.sh +++ b/tests/kconfig.sh @@ -197,7 +197,7 @@ require-kernel-config NETWORK_FILESYSTEMS require-kernel-config 9P_FS # Crash dumps -#if [[ $ktest_crashdump = 1 ]]; then +#if $ktest_crashdump; then # require-kernel-config KEXEC # require-kernel-config CRASH_DUMP # require-kernel-config RELOCATABLE diff --git a/tests/prelude.sh b/tests/prelude.sh index b03399a..349648d 100644 --- a/tests/prelude.sh +++ b/tests/prelude.sh @@ -4,7 +4,7 @@ . $(dirname $(readlink -e "${BASH_SOURCE[0]}"))/../lib/common.sh if [[ ! -v ktest_verbose ]]; then - ktest_verbose=0 + ktest_verbose=false ktest_priority=0 ktest_cpus=$(nproc) ktest_mem="" |