run-docker-test 826 Bytes
Newer Older
1 2 3 4 5 6
#!/bin/bash

#
# Run docker with vunit and ghdl with current directory mounted in /build.
# It is ready to run tests via, for example, `make test_fast coverage`
#
7 8 9
# Can also be run directly with command to run:
#   ./run-docker-test make test_fast
#
10 11 12 13 14 15

if [ -d /build ]; then
    export PATH=/opt/ghdl/bin:$PATH
    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8
    export PYTHONUNBUFFERED=1
16 17
    export HOME=$(mktemp -d /tmp/home.XXXXX)

18
    cd /build/test
19 20 21 22 23
    if [ $# -gt 0 ]; then
        exec "$@"
    else
        exec bash
    fi
24
else
25 26
    d="$(realpath "$(dirname "$0")")"
    #"
27 28 29 30
    docker run --rm -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
        -v "$d:/build" --user $(id -u):$(id -g) --memory 6G \
        registry.gitlab.com/canfd/server-tools/ghdl:gtkwave \
        /build/run-docker-test "$@"
31 32
fi