[PATCH v1 1/2] libubox: fix test_base64.t for bash

Peter Seiderer ps.report at gmx.net
Tue Mar 9 22:05:09 GMT 2021


Hello Petr,

On Sun, 7 Mar 2021 11:27:11 +0100, Petr Štetiar <ynezz at true.cz> wrote:

> Peter Seiderer <ps.report at gmx.net> [2021-03-06 11:54:49]:
> 
> Hi,
> 
> thanks a lot for your nice contribution!
> 
> > My shell/bash seems to emit a more detailed failure message than
> > expected. Fix this by complete avoiding the failure message using
> > command substitution instead of direct command execution.  
> 
> This needs more work as it fails now on my development machine and it would
> fail on CI as well[1].
> 
> You've two options to test your changes from the CI perspective.
> 
> 1. Directly on GitLab
> 
>  - fork the https://gitlab.com/openwrt/project/libubox project under your account
>  - push the changes to that forked repo of yours
>  - CI kicks in automatically and it will use GitLab resources to CI test the
>    changes
> 
> 2. Locally with Docker container
> 
>  (these are basically the steps done on GitLab CI)
> 
>  $ git clone git://git.openwrt.org/project/libubox.git; cd libubox
>  $ wget -q https://gitlab.com/ynezz/openwrt-ci/raw/master/Makefile -O Makefile.ci
>  $ make ci-prepare -f Makefile.ci
>  $ docker run --rm --tty --interactive \
> 	--volume $(pwd):/home/build/openwrt \
> 	--env CI_ENABLE_UNIT_TESTING=1 \
> 	registry.gitlab.com/ynezz/openwrt-ci/native-testing:latest \
> 	make ci-native-checks -f Makefile.ci
> 
>  That `ci-native-checks` target is pipeline[2] of following checks:
> 
>   ci-native-cppcheck - build with cppcheck static analyzer
>   ci-native-scan-build - build with clang's static analyzer
>   ci-native-build - build with gcc 8 9 10 and clang 10
> 
>    - gcc 8/9/10 runs only compile(release,debug)/cram/shunit2 tests
>    - clang 10 runs sanitizer and fuzzer tests in addition to
>      compile(release,debug)/cram/shunit2 tests
> 

Thanks for the detailed instructions, was able to reproduce the failure,
seems it is a divergence between bash and dash (the default /bin/sh
with ubuntu) and my workaround is not working with dash..., but I can
fix the tests for my local run by explicit setting dash for the cram
run (without breaking the docker one) by:

diff --git a/tests/cram/CMakeLists.txt b/tests/cram/CMakeLists.txt
index bebd821..89c868c 100644
--- a/tests/cram/CMakeLists.txt
+++ b/tests/cram/CMakeLists.txt
@@ -14,7 +14,7 @@ ADD_CUSTOM_TARGET(prepare-cram-venv ALL DEPENDS ${PYTHON_VENV_CRAM})
 
 ADD_TEST(
        NAME cram
-       COMMAND ${PYTHON_VENV_CRAM} ${test_cases}
+       COMMAND ${PYTHON_VENV_CRAM} --shell /bin/dash ${test_cases}
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 )
 

Regards,
Peter


> 1. https://gitlab.com/ynezz/openwrt-libubox/-/jobs/1078074565#L1583
> 2. https://gitlab.com/ynezz/openwrt-ci/#available-make-targets
> 
> Cheers,
> 
> Petr
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel




More information about the openwrt-devel mailing list