From ab1a3accb0af1084fea629c677a26286569a5a3e Mon Sep 17 00:00:00 2001 From: Matej Marusak Date: Fri, 19 Jul 2019 12:04:20 +0200 Subject: [PATCH] tests: Introduce `test/run` script for Cockpit External projects use this script to run tests. Let's do the same in Cockpit so `tests/invoke` does not have to differentiate between cockpit and external projects. This counts with a new tests syntax where context is `image[/scenario]`. Closes #12368 --- .gitignore | 1 - test/run | 34 ++++++++++++++++++++++++++++++++++ tools/test-static-code | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 test/run diff --git a/.gitignore b/.gitignore index 18a9ba4fd..92b67f4a8 100644 --- a/.gitignore +++ b/.gitignore @@ -64,7 +64,6 @@ depcomp /test/testlib.pyc /test/*.rpm /test/files/cockpit_test_bridge* -/test/run /test/kdc /cockpit-askpass /cockpit-session diff --git a/test/run b/test/run new file mode 100755 index 000000000..418c57c07 --- /dev/null +++ b/test/run @@ -0,0 +1,34 @@ +#!/bin/sh + +# This is the expected entry point for Cockpit CI; will be called without +# arguments but with an appropriate $TEST_OS, and optionally $TEST_SCENARIO + +set -eu + +TEST_SCENARIO=${TEST_SCENARIO:-verify} +case $TEST_SCENARIO in + verify) + test/image-prepare --verbose $TEST_OS + test/verify/run-tests --jobs ${TEST_JOBS:-1} + ;; + avocado) + test/image-prepare --verbose $TEST_OS + test/avocado/run-tests --quick --tests + ;; + selenium-*) + test/image-prepare --verbose $TEST_OS + test/avocado/run-tests --quick --selenium-tests --browser ${TEST_SCENARIO#*-} + ;; + container-kubernetes) + test/image-prepare --containers --verbose $TEST_OS + test/image-prepare --containers --verbose --install-only openshift + test/containers/run-tests --container kubernetes + ;; + container-*) + test/image-prepare --containers --verbose $TEST_OS + test/containers/run-tests --container ${TEST_SCENARIO#*-} + ;; + *) + echo "Unknown test scenario: $TEST_SCENARIO" + exit 1 +esac diff --git a/tools/test-static-code b/tools/test-static-code index da1e6f48c..7859fe212 100755 --- a/tools/test-static-code +++ b/tools/test-static-code @@ -119,7 +119,7 @@ if [ -z "${PYTHON_STYLE_CHECKER-}" ]; then echo "ok 7 pycodestyle test # SKIP pycodestyle not installed" else # FIXME: Fix code for the warnings and re-enable them - out=$(python3 -m "$PYTHON_STYLE_CHECKER" --ignore E501,E265,E261,W504,W605 test/* --exclude=test/verify/nested-kvm,test/README.md) || true + out=$(python3 -m "$PYTHON_STYLE_CHECKER" --ignore E501,E265,E261,W504,W605 test/* --exclude=test/verify/nested-kvm,test/README.md,test/run) || true if [ -n "$out" ]; then echo "$out" >&2 echo "not ok 7 $PYTHON_STYLE_CHECKER test"