diff --git a/scripts/runtests.sh b/scripts/runtests.sh index 7861c22e..ecddca70 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -4,6 +4,8 @@ set -eux testschema=.subiquity/test-autoinstall-schema.json export PYTHONPATH=$PWD:$PWD/probert:$PWD/curtin +RELEASE=$(lsb_release -rs) + validate () { mode="install" [ $# -gt 0 ] && mode="$1" @@ -70,8 +72,11 @@ for answers in examples/answers*.yaml; do validate grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' .subiquity/subiquity-server-debug.log else - timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --answers $answers --dry-run " < $tty - validate "system_setup" + # The OOBE doesn't exist in WSL < 20.04 + if [ "${RELEASE%.*}" -ge 20 ]; then + timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --answers $answers --dry-run " < $tty + validate "system_setup" + fi fi done @@ -107,17 +112,21 @@ while ! scurl a/meta/status >& /dev/null ; do done scurl a/storage/has_bitlocker | jq -M '. [0].partitions[2]' | grep -q BitLocker -# NOTE: -# This test doesnt do much ATM but it will be useful when we have more complex scenarios to test with the server and client code. -# Like generating a wsl.conf file and comparing it to the oracle. -clean -timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup.yaml --dry-run" +# The OOBE doesn't exist in WSL < 20.04 +if [ "${RELEASE%.*}" -ge 20 ]; then + # NOTE: + # This test doesnt do much ATM but it will be useful when we have more complex scenarios to test with the server and client code. + # Like generating a wsl.conf file and comparing it to the oracle. + clean + timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup.yaml --dry-run" + + python3 -m system_setup.cmd.schema > "$testschema" + scripts/schema-cmp.py "autoinstall-system-setup-schema.json" "$testschema" --ignore-tz +fi python3 -m subiquity.cmd.schema > "$testschema" scripts/schema-cmp.py "autoinstall-schema.json" "$testschema" -python3 -m system_setup.cmd.schema > "$testschema" -scripts/schema-cmp.py "autoinstall-system-setup-schema.json" "$testschema" --ignore-tz set +x # show PASS/FAIL as the last line of output echo 'Runtests all PASSED'