[PATCH 13/20] gitlab: Use bash to avoid needing a_test_which_does_not_exist
Tom Rini
trini at konsulko.com
Mon Mar 9 18:56:24 CET 2020
On Fri, Mar 06, 2020 at 08:07:27PM -0700, Simon Glass wrote:
> 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
Please change the comment to note that other less-than-obvious bash
feature being used here, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200309/c59dd63c/attachment.sig>
More information about the U-Boot
mailing list