[PATCH 13/20] gitlab: Use bash to avoid needing a_test_which_does_not_exist
Simon Glass
sjg at chromium.org
Sat Mar 7 04:07:27 CET 2020
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 <sjg at chromium.org>
---
.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
--
2.25.1.481.gfbce0eb801-goog
More information about the U-Boot
mailing list