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)
# 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
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
+```
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"
"${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 "$@"