[pygobject] [tests] Separate processes for GI and static binding tests.



commit 6ef83c049735689c42f085ca9d7b8e1f251c410f
Author: Laszlo Pandy <lpandy src gnome org>
Date:   Tue Feb 15 20:07:42 2011 +0100

    [tests] Separate processes for GI and static binding tests.
    
    Importing and using both static gobject bindings and
    introspection GObject bindings in the same process can cause
    conflicts with types which otherwise wouldn't be there.
    
    This patch changes "make check" to call runtests.py twice -- once
    for each set of tests.
    
    In the case of a test failure, runtests.py now sets the exit code
    so that make does not continue. Otherwise you might miss the
    failures from the first batch of tests in the scrollback.

 tests/Makefile.am |   19 +++++++++++--------
 tests/runtests.py |    4 +++-
 2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 23d049b..c49a768 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -68,7 +68,7 @@ testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
 
 all: $(LTLIBRARIES:.la=.so)
 
-TEST_FILES = \
+TEST_FILES_STATIC = \
 	test_gobject.py \
 	test_interface.py \
 	test_mainloop.py \
@@ -80,8 +80,9 @@ TEST_FILES = \
 	test_thread.py \
 	test_uris.py
 
+
 if ENABLE_INTROSPECTION
-TEST_FILES += \
+TEST_FILES_GI = \
 	test_everything.py \
 	test_gi.py \
 	test_gdbus.py \
@@ -97,20 +98,22 @@ EXTRA_DIST = \
 	test-unknown.h \
 	org.gnome.test.gschema.xml
 
-EXTRA_DIST += $(TEST_FILES)
+EXTRA_DIST += $(TEST_FILES_STATIC) $(TEST_FILES_GI)
 
 clean-local:
 	rm -f $(LTLIBRARIES:.la=.so) file.txt~
 
 DBUS_LAUNCH=$(shell which dbus-launch)
-
-check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
-	TEST_FILES="$(TEST_FILES)" \
+RUN_TESTS_ENV_VARS= \
 	PYTHONPATH=$(top_builddir):$(top_builddir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \
 	LD_LIBRARY_PATH=$(builddir)/.libs:$$LD_LIBRARY_PATH \
 	GI_TYPELIB_PATH=$(builddir):$$GI_TYPELIB_PATH \
-	XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share \
-	$(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py
+	XDG_DATA_DIRS=$$XDG_DATA_DIRS:/usr/share
+RUN_TESTS_LAUNCH=$(RUN_TESTS_ENV_VARS) $(DBUS_LAUNCH) $(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py
+
+check-local: $(LTLIBRARIES:.la=.so) Regress-1.0.typelib GIMarshallingTests-1.0.typelib gschemas.compiled
+	TEST_FILES="$(TEST_FILES_STATIC)" $(RUN_TESTS_LAUNCH)
+	TEST_FILES="$(TEST_FILES_GI)" $(RUN_TESTS_LAUNCH)
 
 check.gdb:
 	EXEC_NAME="gdb --args" $(MAKE) check
diff --git a/tests/runtests.py b/tests/runtests.py
index 66b9eec..37fc6f0 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -34,5 +34,7 @@ suite = loader.loadTestsFromNames(names)
 
 # Run tests.
 runner = unittest.TextTestRunner(verbosity=2)
-runner.run(suite)
+result = runner.run(suite)
+if not result.wasSuccessful():
+	sys.exit(1) # exit code so "make check" reports error
 



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