[gjs] tests: Don't time out when run under gdb



commit a3a97c41aa72f13ab5282b8f7f2046d2fc23af87
Author: Colin Walters <walters verbum org>
Date:   Thu Oct 28 10:26:58 2010 -0400

    tests: Don't time out when run under gdb
    
    Have the test timeout behavior be controlled by the GJS_TEST_TIMEOUT
    environment variable, and the "gdb-check" target set that to 0.  This
    ensures the process won't suicide when you're in the middle of
    investigating a crash.

 Makefile-test.am |    3 ++-
 test/gjs-unit.c  |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index 7eebc34..8933c83 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -110,6 +110,7 @@ TESTS_ENVIRONMENT =							\
 	GJS_DEBUG_OUTPUT=test_user_data/logs/gjs.log			\
 	BUILDDIR=.							\
 	GJS_USE_UNINSTALLED_FILES=1					\
+	GJS_TEST_TIMEOUT=420						\
 	GI_TYPELIB_PATH=$(builddir)					\
 	LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(FIREFOX_JS_LIBDIR)"	\
 	G_FILENAME_ENCODING=latin1	# ensure filenames are not utf8
@@ -121,7 +122,7 @@ check:	test
 
 gdb-check gdb-test: $(gjsnative_LTLIBRARIES) ${TEST_PROGS}
 	failed=; for prog in ${TEST_PROGS}; do \
-	  ${TESTS_ENVIRONMENT} libtool --mode=execute gdb -x \
+	  ${TESTS_ENVIRONMENT} GJS_TEST_TIMEOUT=0 libtool --mode=execute gdb -x \
 	      $(top_srcdir)/test/unittest.gdb --args $$prog; \
 	  done
 
diff --git a/test/gjs-unit.c b/test/gjs-unit.c
index 39b4a49..1b561c7 100644
--- a/test/gjs-unit.c
+++ b/test/gjs-unit.c
@@ -181,7 +181,14 @@ main(int argc, char **argv)
      */
     g_setenv("GJS_DISABLE_JIT", "1", FALSE);
 
-    gjs_crash_after_timeout(60*7); /* give the unit tests 7 minutes to complete */
+    {
+        const char *timeout_str = g_getenv("GJS_TEST_TIMEOUT");
+        if (timeout_str != NULL) {
+            guint timeout = (guint)g_ascii_strtoull(timeout_str, NULL, 10);
+            if (timeout > 0)
+                gjs_crash_after_timeout(timeout);
+        }
+    }
     gjs_init_sleep_on_crash();
 
     setlocale(LC_ALL, "");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]