Thanks Aaron.
I made a small tweaks to ovs-macros.at, so that when test suite fails,
ovs_on_exit() function will be called. And in this function, a check is
made to see if an environment variable to OVS_PAUSE_TEST is set. If it is
set, then test suite is paused and will continue to wait for user input
Ctrl-D. Meanwhile user can poke around the system to see why test case has
failed. Once done with investigation, user can press ctrl-d to cleanup the
test suite.
For example, to re-run test case 139:
export OVS_PAUSE_TEST=1
cd tests/system-userspace-testsuite.dir/139
sudo -E ./run
When error occurs, above command would display something like this:
=====================================================
Set environment variable to use various ovs utilities
export
OVS_RUNDIR=/opt/vdasari/Developer/ovs/_build-gcc/tests/system-userspace-testsuite.dir/139
Press ctrl-d to continue:
And from another window, one can execute ovs-xxx commands like:
export
OVS_RUNDIR=/opt/vdasari/Developer/ovs/_build-gcc/tests/system-userspace-testsuite.dir/139
$ ovs-ofctl dump-ports br0
.
.
Here is the tweak looks like:
diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index 10593429d..5da61c654 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -35,11 +35,36 @@ m4_divert_push([PREPARE_TESTS])
# directory.
ovs_init() {
ovs_base=`pwd`
- trap '. "$ovs_base/cleanup"' 0
+ trap ovs_on_exit 0
: > cleanup
ovs_setenv
}
+# Catch testsuite error condition and cleanup test environment by tearing
down
+# all interfaces and processes spawned.
+# User has an option to leave the test environment in error state so that
system
+# can be poked around to get more information. User can enable this option
by setting
+# environment variable OVS_PAUSE_TEST=1. User needs to press CTRL-D to
resume the
+# cleanup operation.
+ovs_pause() {
+ echo "====================================================="
+ echo "Set environment variable to use various ovs utilities"
+ echo "export OVS_RUNDIR=$ovs_base"
+ echo "Press ctrl-d to continue:"
+ while read -s -n 1 key; do
+ printf -v keycode "%d" "'$key"
+ [ $keycode -ne 4 ] || break
+ done
+}
+
+ovs_on_exit () {
+ if [ ! -z "${OVS_PAUSE_TEST}" ]; then
+ ovs_pause
+ fi
+ . "$ovs_base/cleanup"
+}
+
# With no parameter or an empty parameter, sets the OVS_*DIR
# environment variables to point to $ovs_base, the base directory in
# which the test is running.
If you think that this would be helpful I can raise a patch with this
change.
-Vasu
*Vasu Dasari*
On Fri, Jun 21, 2019 at 10:49 AM Aaron Conole <[email protected]> wrote:
> Vasu Dasari <[email protected]> writes:
>
> > Hi,
> >
> > I would like to know what is the procedure you follow to debug "Testing"
> failures.
> >
> > For example, on my Ubuntu system, I am trying to execute
> system-userspace test case like this.
> >
> > sudo make -C _build-gcc/ -s check-system-userspace TESTSUITEFLAGS='-k
> "ptap - triangle bridge setup with L2
> > and L3 GRE tunnels"'
> >
> > This is failing on my system. I would like to debug this by starting a
> switch with the same configuration that
> > was done on the switch.
>
> It's possible in at least two ways I can think of:
>
> 1. modify the 'run' to eliminate the "on_exit" calls that will tear
> down the ovs-vswitchd (and the associated links).
>
> 2. Follow the scripts in '.at' and manually run the tests.
>
> > I do see that test related information is present at
> tests/system-userspace-testsuite.dir/139. And there is a
> > script called "run" which can be used to redo the test. But,
> ovs-vswitchd is killed when script fails.
> >
> > 1. Are there any options I can give to ./run or to "testsuite" to not to
> perform kill operation so that I can
> > continue to debug the switch from where it failed.
> > 2. How can I recreate the switch instance from conf.db we got from
> failed test? I tried to copy conf.db to
> > "ovs/_run" directory and started "utilities/ovs-dev.py run" to start the
> switch. But, not all interfaces created
> > properly. For example, on some interfaces I do see errors like this. So
> probably I might be missing some steps
> > here.
> > Port "p2-0"
> > Interface "p2-0"
> > error: "could not open network device p2-0 (No such
> device)"
>
> That happens because when interfaces and netns are added, there is a
> separate call made to on_exit so that when the script terminates, they
> are torn down.
>
> Hope it helps!
>
> > Thanks
> > -Vasu
> >
> > Vasu Dasari
>
_______________________________________________
discuss mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss