tests: Avoid Windows unit tests from hanging.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 8 Apr 2015 00:17:39 +0000 (17:17 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 22 Apr 2015 20:13:28 +0000 (13:13 -0700)
commit5e65e080ad4d57eb3fcb7b53980cf6a4d1e8ae19
treeff768a1058f31836013b0031d05d14a783bce543
parenta1dbf3d890984484aec06c7dfba912180b621c18
tests: Avoid Windows unit tests from hanging.

It has been observed that sometimes Windows unit tests hang.
This happens when a daemon is started but does not get terminated
when the test ends.

In one particular case, OVS_VSWITCHD_STOP is called which inturn
calls 'ovs-appctl exit'. This causes ovs-vswitchd's atexit handler
to cleanup the pidfiles. After this, the pthread destructurs get
called and a deadlock happens in there. This results in the
daemons not getting force killed resulting in the tests hanging
because the cleanup file tries to run the command
"kill `cat ovs-vswitchd.pid`" and ovs-vswitchd.pid no longer exists.

With this commit, we write the pid value of the daemons in the
cleanup file (instead of asking it to 'cat' the value later from
the pidfile). This way, even if the pidfiles get deleted, we can
still kill the daemons.

This commit also changes the way daemons are force killed in
Windows. It was observed that 'taskkill //F ' failed to kill
a deadlocked daemon running its pthread destructor. But
tskill succeeds.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
(ON_EXIT_UNQUOTED macro provided by Ben.)
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests/ofproto-macros.at
tests/ovs-macros.at