From patchwork Sat Mar 7 03:07:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 243331 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Fri, 6 Mar 2020 20:07:27 -0700 Subject: [PATCH 13/20] gitlab: Use bash to avoid needing a_test_which_does_not_exist In-Reply-To: <20200307030734.237401-1-sjg@chromium.org> References: <20200307030734.237401-1-sjg@chromium.org> Message-ID: <20200307030734.237401-9-sjg@chromium.org> Bash allows for variables to expand only if non-empty: $ var=test $ echo ${var:+"$var"} test $ echo ${var:+"-k $var"} -k test $ var= $ echo ${var:+"-k $var"} Use this feature to avoid the workaround. Signed-off-by: Simon Glass --- .gitlab-ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bbd05aa872..05f56c6d19 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,17 +36,13 @@ stages: if [[ $ret -ne 0 && $ret -ne 129 ]]; then exit $ret; fi - # "not a_test_which_does_not_exist" is a dummy -k parameter which will - # never prevent any test from running. That way, we can always pass - # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom - # value. - virtualenv -p /usr/bin/python3 /tmp/venv - . /tmp/venv/bin/activate - pip install -r test/py/requirements.txt - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH}; export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci; ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} - -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" + ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR"; ret=$?; if [[ $ret -ne 0 ]]; then