[riot-notifications] [RIOT-OS/RIOT] murdock and tests using `utf-8` characters (#11691)

Gaëtan Harter notifications at github.com
Thu Jul 11 14:45:54 CEST 2019


>From local testing, it looks like it should be configured in the `riotdocker` image.

Currently the locale in the container is `"POSIX"` whatever that means

```
locale                                                                                                                                                                                                                                                                                    
LANG=                                                                                                                                                                                                                                                                                     
LANGUAGE=                                                                                                                                                                                                                                                                                 
LC_CTYPE="POSIX"                                                                                                                                                                                                                                                                          
LC_NUMERIC="POSIX"                                                                                                                                                                                                                                                                        
LC_TIME="POSIX"                                                                                                                                                                                                                                                                           
LC_COLLATE="POSIX"                                                                                                                                                                                                                                                                        
LC_MONETARY="POSIX"                                                                                                                                                                                                                                                                       
LC_MESSAGES="POSIX"                                                                                                                                                                                                                                                                       
LC_PAPER="POSIX"                                                                                                                                                                                                                                                                          
LC_NAME="POSIX"                                                                                                                                                                                                                                                                           
LC_ADDRESS="POSIX"                                                                                                                                                                                                                                                                        
LC_TELEPHONE="POSIX"                                                                                                                                                                                                                                                                      
LC_MEASUREMENT="POSIX"                                                                                                                                                                                                                                                                    
LC_IDENTIFICATION="POSIX"                                                                                                                                                                                                                                                                 
LC_ALL=                     
```

By doing a local test inspired from https://github.com/RIOT-OS/RIOT/pull/11220 it fails in the current `docker` image with a `samr21-xpro`.
I could not run `native` though due to a `native_cpu_init: getcontext: Operation not permitted` issue so ignored it.

```
BOARD=samr21-xpro make -C tests/lua_loader/ flash
DOCKER_FLAGS='--rm --privileged -i --group-add plugdev --group-add dialout --device=$(PORT)' BUILD_IN_DOCKER=1 DOCKER="sudo docker" BOARD=samr21-xpro make -C tests/lua_loader/ flash
```

The test fails due to the encoding errors.

```
print((require"m2").a)
2019-07-11 14:40:12,635 - INFO # chega de repente
print((require"c1").X)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 48: ordinal not in range(128)
```

When adding `-e LC_ALL=C.UTF-8` it works:

<details><summary><code>DOCKER_FLAGS='--rm --privileged -i --group-add plugdev --group-add dialout --device=$(PORT) -e LC_ALL=C.UTF-8' BUILD_IN_DOCKER=1 DOCKER="sudo docker" BOARD=samr21-xpro make -C tests/lua_loader/ test</code></summary>

```
DOCKER_FLAGS='--rm --privileged -i --group-add plugdev --group-add dialout --device=$(PORT) -e LC_ALL=C.UTF-8' BUILD_IN_DOCKER=1 DOCKER="sudo docker" BOARD=samr21-xpro make -C tests/lua_loader/ test
make: Entering directory '/home/harter/work/git/RIOT/tests/lua_loader'
Launching build container using image "riot/riotbuild:latest".
sudo docker run --rm --privileged -i --group-add plugdev --group-add dialout --device=/dev/ttyACM0 -e LC_ALL=C.UTF-8 -t -u "$(id -u)" \
    -v '/usr/share/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/harter/work/git/RIOT:/data/riotbuild/riotbase' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles' -v /home/harter/.gitcache:/data/riotbuild/gitcache -e GIT_CACHE_DIR=/data/riotbuild/gitcache   \
    -e 'BOARD=samr21-xpro' \
    -w '/data/riotbuild/riotbase/tests/lua_loader/' \
    'riot/riotbuild:latest' make test
python3 -m easy_install --user pyserial
Searching for pyserial
Reading https://pypi.python.org/simple/pyserial/
Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl#sha256=e0770fadba80c31013896c7e6ef703f72e7834965954a78e71a3049488d4d7d8
Best match: pyserial 3.4
Processing pyserial-3.4-py2.py3-none-any.whl
Installing pyserial-3.4-py2.py3-none-any.whl to /data/riotbuild/.local/lib/python3.6/site-packages
Adding pyserial 3.4 to easy-install.pth file
Installing miniterm.py script to /data/riotbuild/.local/bin

Installed /data/riotbuild/.local/lib/python3.6/site-packages/pyserial-3.4-py3.6.egg
Processing dependencies for pyserial
Finished processing dependencies for pyserial
/data/riotbuild/riotbase/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"
Twisted not available, please install it if you want to use pyterm's JSON capabilities
2019-07-11 14:40:57,643 - INFO # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2019-07-11 14:41:00,825 - INFO # main(): This is RIOT! (Version: 2019.10-devel-25-g6b094)
2019-07-11 14:41:00,832 - INFO # I am a module, hi!
print((require"m1").a)
2019-07-11 14:41:00,895 - INFO # Quando uma lua
print((require"m2").a)
2019-07-11 14:41:00,957 - INFO # chega de repente
print((require"c1").X)
2019-07-11 14:41:01,019 - INFO # E se deixa no céu,
print((require"c2").X)
2019-07-11 14:41:01,081 - INFO # como esquecida

make: Leaving directory '/home/harter/work/git/RIOT/tests/lua_loader'
```
</details>

I used this minimal diff to put `test` in docker.

``` diff
git diff
diff --git a/Makefile.include b/Makefile.include
index 37509aacb..6339bba60 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -600,10 +600,15 @@ TESTS ?= $(foreach file,$(wildcard $(APPDIR)/tests/*[^~]),\
 # See #11762.
 TEST_DEPS += $(TERMDEPS)
 
+ifeq ($(BUILD_IN_DOCKER),1)
+test: ..in-docker-container
+else
 test: $(TEST_DEPS)
+       python3 -m easy_install --user pyserial
        $(Q) for t in $(TESTS); do \
                $$t || exit 1; \
        done
+endif
 
 test/available:
        $(Q)test -n "$(strip $(TESTS))"
diff --git a/makefiles/docker.inc.mk b/makefiles/docker.inc.mk
index d7249b5f5..ffb05efd1 100644
--- a/makefiles/docker.inc.mk
+++ b/makefiles/docker.inc.mk
@@ -5,6 +5,7 @@ export DOCKER_FLAGS ?= --rm
 # List of Docker-enabled make goals
 export DOCKER_MAKECMDGOALS_POSSIBLE = \
   all \
+  test \
   buildtest \
   scan-build \
   scan-build-analyze \
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11691#issuecomment-510470398
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190711/981d61ed/attachment-0001.html>


More information about the notifications mailing list