On Fri, Jul 17, 2015 at 05:15:04PM -0700, Jarno Rajahalme wrote:
> Ben,
> 
> This works, the core file names can be found from the testsuite.log!
> 
> It would be super nice to have the cores reported on the “Test Results” 
> section of the make check output, though:
> 
> ## ------------- ##
> ## Test results. ##
> ## ------------- ##
> 
> ERROR: All 7 tests were run,
> 3 failed unexpectedly.
> 
> If the presence of core files was mentioned here, I would know not to
> blindly issues a recheck. Or better yet, maybe “recheck” should
> automatically fail if any of the failed tests produced a core file?

I don't know a good place to "hook" Autotest to put a warning about core
files into the summary output.  It can be wrapped (this uses reverse
video to make the message visible, otherwise it gets lost in all the
garbage that "make" prints).  I'm not really happy with it though:

diff --git a/tests/automake.mk b/tests/automake.mk
index 153d4e1..fb7ee3f 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -98,7 +98,12 @@ DISTCLEANFILES += tests/atconfig tests/atlocal
 AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests:$(PTHREAD_WIN32_DIR_DLL)
 
 check-local: tests/atconfig tests/atlocal $(TESTSUITE)
-       $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) 
$(TESTSUITEFLAGS)
+       $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) 
$(TESTSUITEFLAGS); status=$$?; \
+       if test -f tests/testsuite.dir/corefail; then \
+           echo "`tput smso`Some tests dumped core.`tput rmso`"; \
+       fi; \
+       exit $$status
+
 
 # Python Coverage support.
 # Requires coverage.py http://nedbatchelder.com/code/coverage/.
diff --git a/tests/daemon-py.at b/tests/daemon-py.at
index cafa8df..b0f1236 100644
--- a/tests/daemon-py.at
+++ b/tests/daemon-py.at
@@ -59,7 +59,7 @@ AT_CHECK(
 AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`])
 OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid],
   [kill `cat parent`])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([daemon --monitor restart exit code - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
diff --git a/tests/daemon.at b/tests/daemon.at
index 51d56c5..6dac76a 100644
--- a/tests/daemon.at
+++ b/tests/daemon.at
@@ -66,7 +66,7 @@ AT_CHECK(
 AT_CHECK([kill `cat pid`], [0], [], [ignore], [kill `cat parent`])
 OVS_WAIT_WHILE([kill -0 `cat parent` || kill -0 `cat newpid` || test -e pid],
   [kill `cat parent`])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([daemon --detach])
 AT_CAPTURE_FILE([pid])
@@ -89,7 +89,7 @@ else
 fi
 OVS_WAIT_WHILE([kill -0 `cat saved-pid`])
 AT_CHECK([test ! -e pid])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([daemon --detach --monitor])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
@@ -139,7 +139,7 @@ OVS_WAIT_WHILE(
   [kill -0 `cat monitor` || kill -0 `cat newdaemon` || test -e daemon],
   [kill `cat monitor newdaemon`])
 m4_undefine([CHECK])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([daemon --detach startup errors])
 AT_CAPTURE_FILE([pid])
diff --git a/tests/heap.at b/tests/heap.at
index 5267564..823ed91 100644
--- a/tests/heap.at
+++ b/tests/heap.at
@@ -3,6 +3,7 @@ AT_BANNER([heap library])
 m4_define([TEST_HEAP],
   [AT_SETUP([heap library -- m4_bpatsubst([$1], [-], [ ])])
    AT_CHECK([ovstest test-heap $1])
+   touch core
    AT_CLEANUP])
 
 TEST_HEAP([insert-delete-same-order])
diff --git a/tests/library.at b/tests/library.at
index 9bd6d81..e5e02c5 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -195,7 +195,7 @@ AT_CHECK([sed 's/.*: //
   [assertion false failed in test_assert()
 ])
 
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([snprintf])
 AT_CHECK([ovstest test-util snprintf])
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index 8fce70e..b147e06 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -284,7 +284,7 @@ AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
   [0], [constraints
 ordinals
 ])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([ovsdb-server/add-db and remove-db with --monitor])
 AT_KEYWORDS([ovsdb server positive])
@@ -315,7 +315,7 @@ OVS_WAIT_UNTIL(
 AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/list-dbs],
   [0], [ordinals
 ])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([--remote=db: implementation])
 AT_KEYWORDS([ovsdb server positive])
@@ -465,7 +465,7 @@ OVS_WAIT_WHILE([kill -0 `cat old.pid`])
 OVS_WAIT_UNTIL(
   [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
 OVS_WAIT_UNTIL([test -S socket1])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([ovsdb-server/add-remote and remove-remote with --monitor])
 AT_KEYWORDS([ovsdb server positive])
@@ -500,7 +500,7 @@ OVS_WAIT_WHILE([kill -0 `cat old.pid`])
 OVS_WAIT_UNTIL(
   [test -s ovsdb-server.pid && test `cat ovsdb-server.pid` != `cat old.pid`])
 AT_CHECK([test ! -e socket1])
-AT_CLEANUP
+AT_CLEANUP_IGNORE_CORES
 
 AT_SETUP([SSL db: implementation])
 AT_KEYWORDS([ovsdb server positive ssl $5])
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 92b788b..7635d70 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -14,6 +14,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 
or implied.
 See the License for the specific language governing permissions and
 limitations under the License.])
 
+dnl This modifies Autotest so that AT_CLEANUP checks for core dumps
+dnl and fails the test if any of them are present.  At the same time,
+dnl some of our tests intentionally kill processes with signals that
+dnl can cause core dumps, so this introduces AT_CLEANUP_IGNORE_CORES
+dnl to ignore core dumps in that case.
+m4_rename([AT_CLEANUP], [AT_CLEANUP_IGNORE_CORES])
+m4_define([AT_CLEANUP], [dnl
+    AT_CHECK([find . -name "core*" -print], [0], [], [], [touch ../corefail])
+    AT_CLEANUP_IGNORE_CORES])
+
 m4_include([tests/ovs-macros.at])
 m4_include([tests/ovsdb-macros.at])
 m4_include([tests/ofproto-macros.at])
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to