]> git.puffer.fish Git - mirror/frr.git/commitdiff
Docker: Use pytest as default command
authorChristian Franke <chris@opensourcerouting.org>
Thu, 18 Oct 2018 11:48:55 +0000 (13:48 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Thu, 29 Nov 2018 15:51:27 +0000 (16:51 +0100)
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
tests/topotests/README.md
tests/topotests/docker/README.md
tests/topotests/docker/inner/compile_frr.sh
tests/topotests/docker/inner/entrypoint.sh

index 47668f4bba3fa607c6fac2cc33fc7bc752d17530..3f1323c21817b1634ccef92888844fe424ddc749 100644 (file)
@@ -11,6 +11,10 @@ that does what you need. If nothing is similar, then you may create a
 new topology, preferably, using the newest
 [template](example-test/test_template.py).
 
+## Running tests with docker
+
+There is a docker image which allows to run topotests. Instructions can be
+found [here](docker/README.md).
 
 ## Installation of Mininet for running tests
 Only tested with Ubuntu 16.04 and Ubuntu 18.04 (which uses Mininet 2.2.x)
index b506fd6fb16194a40431aeb728c15227d739eed6..25b18da7dc27879af600da30007ae89a95e589b5 100644 (file)
@@ -1,6 +1,6 @@
 # Topotests in Docker
 
-## Usage
+## Quickstart
 
 If you have Docker installed, you can run the topotests in Docker.
 The easiest way to do this, is to use the `frr-topotests.sh` script
@@ -14,8 +14,35 @@ chmod +x /usr/local/bin/frr-topotests
 
 Once this script is in place, simply run it while you are inside your FRR repository:
 
-```
+```console
 frr-topotests
 ```
 
-It should build FRR inside of the container and run the topotests on it.
+## Advanced Usage
+
+There are several environtment variables which can be used to modify the behavior of
+the image. Those can be listed using `frr-topotests -h`.
+
+For example, a volume is used to cache build artifacts between multiple runs
+of the image. If you need to force a complete recompile, you can set `TOPOTEST_CLEAN`:
+
+```console
+TOPOTEST_CLEAN=1 frr-topotests
+```
+
+By default, `frr-topotests` will execute pytest without any arguments. If you append an
+arguments with the first one starting with `/` or `./`, they will replace the call to
+pytest. If the appended arguments do not match this patttern, they will be provided to
+pytest as arguments.
+
+So, to run a specific test with more verbose logging:
+
+```console
+frr-topotests -vv -s all-protocol-startup/test_all_protocol_startup.py
+```
+
+And to compile FRR but drop into a shell instead of running pytest:
+
+```console
+frr-topotests /bin/bash
+```
index 579994f83dfd5ab65d53820c23826b21e97458a0..896514b5d5cdb91b0013211d05b0fa92badaee80 100755 (executable)
@@ -83,11 +83,15 @@ if [ ! -e Makefile ]; then
        fi
 
        bash configure >&3 \
-               --enable-multipath=64 \
+               --enable-static-bin \
+               --with-moduledir=/usr/lib/frr/modules \
                --prefix=/usr \
                --localstatedir=/var/run/frr \
                --sbindir=/usr/lib/frr \
                --sysconfdir=/etc/frr \
+               --enable-multipath=0 \
+               --enable-fpm \
+               --enable-sharpd \
                $EXTRA_CONFIGURE \
                --with-pkg-extra-version=-topotests \
                || log_fatal "failed to configure the sources"
index dd329619f83a5dd1e2d8beb5933c882b9913c2c5..37c5b75bf7f51e3a57191a469ff92a599d4b6003 100755 (executable)
@@ -33,9 +33,12 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 "${CDIR}/openvswitch.sh"
 
 log_info "Setting permissions on /tmp so we can generate logs"
-chmod -v 1777 /tmp
+chmod 1777 /tmp
 
-log_info "Starting bash shell to interact with topotests"
-echo ''
+if [ $# -eq 0 ] || ([[ "$1" != /* ]] && [[ "$1" != ./* ]]); then
+       export TOPOTESTS_CHECK_MEMLEAK=/tmp/memleak_
+       export TOPOTESTS_CHECK_STDERR=Yes
+       set -- pytest --junitxml /tmp/topotests.xml "$@"
+fi
 
-exec bash
+exec "$@"