From 335edef764dc8a37c68bc9a6f4fdc1ed182ebf16 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 15 Jul 2013 15:37:22 +0100 Subject: [PATCH] Avoid calling abort() on windows when running the test suite, so that the test suite doesn't get suspended waiting for someone to press a button. Copied from Perforce Change: 183041 ServerID: perforce.ravenbrook.com --- mps/code/commpost.nmk | 1 + mps/code/testlib.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mps/code/commpost.nmk b/mps/code/commpost.nmk index 5984a9b4d35..d0d1e3a3d36 100644 --- a/mps/code/commpost.nmk +++ b/mps/code/commpost.nmk @@ -61,6 +61,7 @@ mpsicv.cov: testrun: $(AUTO_TEST_TARGETS) !IFDEF VARIETY + set MPS_TESTLIB_NOABORT=true ..\tool\testrun.bat $(PFM) $(VARIETY) $(AUTO_TEST_TARGETS) !ELSE $(MAKE) /nologo /f $(PFM).nmk VARIETY=hot testrun diff --git a/mps/code/testlib.c b/mps/code/testlib.c index fe81040ae85..bcb0801f3e1 100644 --- a/mps/code/testlib.c +++ b/mps/code/testlib.c @@ -328,7 +328,16 @@ void verror(const char *format, va_list args) vfprintf(stderr, format, args); fprintf(stderr, "\n"); fflush(stderr); /* make sure the message is output */ - abort(); + /* On Windows, the abort signal pops up a dialog box. This suspends + * the test suite until a button is pressed, which is not acceptable + * for offline testing, so if the MPS_TESTLIB_NOABORT environment + * variable is set, then the test case exits instead of aborting. + */ + if (getenv("MPS_TESTLIB_NOABORT")) { + exit(EXIT_FAILURE); + } else { + abort(); + } }