10 # Put built tools early in $PATH.
12 if test ! -e vswitchd/ovs-vswitchd; then
13 echo >&2 'not in build directory, please change directory or run via \"make check-oftest'
16 PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$PATH; export PATH
20 '') srcdir=$builddir ;;
22 *) srcdir=`pwd`/$srcdir ;;
24 if test ! -e "$srcdir"/WHY-OVS; then
25 echo >&2 'source directory not found, please set $srcdir or run via \"make check-oftest'
29 # Make sure oftest is available.
30 if test X"$OFT" = X; then
33 if ($OFT --version) >/dev/null 2>&1; then
36 echo >&2 'OFTest "oft" binary not found or cannot be run, please add to $PATH or set $OFT'
46 # Set up environment for OVS programs to sandbox themselves.
47 OVS_RUNDIR=$sandbox; export OVS_RUNDIR
48 OVS_LOGDIR=$sandbox; export OVS_LOGDIR
49 OVS_DBDIR=$sandbox; export OVS_DBDIR
50 OVS_SYSCONFDIR=$sandbox; export OVS_SYSCONFDIR
52 trap 'kill `cat *.pid`' 0 1 2 3 13 14 15
54 # Create database and start ovsdb-server.
57 run ovsdb-tool create conf.db "$srcdir"/vswitchd/vswitch.ovsschema
58 run ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \
59 --remote=punix:"$sandbox"/db.sock
62 run ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file \
63 --enable-dummy --disable-system -vvconn -vnetdev_dummy
65 # Add a bridge and some ports for OFTest to use,
66 # and configure ovs-vswitchd to connect to OFTest.
67 run ovs-vsctl --no-wait \
69 -- set bridge br0 datapath-type=dummy fail-mode=secure
70 for port in p1 p2 p3 p4; do
71 run ovs-vsctl --no-wait \
72 -- add-port br0 $port \
73 -- set interface $port type=dummy \
74 options:pstream=punix:$OVS_RUNDIR/$port
77 -- set-controller br0 tcp:127.0.0.1:6653 \
78 -- set controller br0 connection-mode=out-of-band max-backoff=1000
81 run $OFT -P ovs-dummy $OFTFLAGS; status=$?
85 ----------------------------------------------------------------------
86 Logs may be found under $sandbox, e.g.:
88 $sandbox/ovs-vswitchd.log
89 $sandbox/ovsdb-server.log
90 ----------------------------------------------------------------------
93 # Propagate OFTest exit status.