diff options
author | Laszlo Pandy <lpandy@src.gnome.org> | 2011-02-15 20:07:42 +0100 |
---|---|---|
committer | Laszlo Pandy <lpandy@src.gnome.org> | 2011-02-15 21:00:30 +0100 |
commit | 888675f85c895a60d4432b992961ec3067da6e20 (patch) | |
tree | 54a6c7264874fae7099824eb592c77806ac84eef | |
parent | 71b0dd93d524afce9f4a4b0b393c8a16a1f70e2f (diff) | |
download | pygobject-888675f85c895a60d4432b992961ec3067da6e20.tar.gz |
[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.
-rw-r--r-- | tests/Makefile.am | 29 | ||||
-rw-r--r-- | tests/runtests.py | 4 |
2 files changed, 15 insertions, 18 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index fb3d8e79..e5c2a687 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 \ @@ -81,7 +81,7 @@ TEST_FILES = \ test_uris.py if BUILD_GIO -GIO_TEST_FILES = \ +TEST_FILES_GIO = \ test_gio.py \ test_gresolver.py \ test_gsocket.py \ @@ -90,7 +90,7 @@ GIO_TEST_FILES = \ endif if ENABLE_INTROSPECTION -TEST_FILES += \ +TEST_FILES_GI = \ test_everything.py \ test_gi.py \ test_gdbus.py \ @@ -106,30 +106,25 @@ EXTRA_DIST = \ test-unknown.h \ org.gnome.test.gschema.xml -EXTRA_DIST += $(TEST_FILES) +EXTRA_DIST += $(TEST_FILES_STATIC) $(TEST_FILES_GI) $(TEST_FILES_GIO) clean-local: rm -f $(LTLIBRARIES:.la=.so) file.txt~ DBUS_LAUNCH=$(shell which dbus-launch) - -# need to run the gio tests separately to avoid loading gi.repository.Gio and -# gio at the same time -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 +# run tests in separately to avoid loading static and introspection bindings in the same process +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) if BUILD_GIO - TEST_FILES="$(GIO_TEST_FILES)" \ - 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 \ - $(EXEC_NAME) $(PYTHON) $(srcdir)/runtests.py + TEST_FILES="$(TEST_FILES_GIO)" $(RUN_TESTS_LAUNCH) endif check.gdb: diff --git a/tests/runtests.py b/tests/runtests.py index 54c65aa9..2dc17e09 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -25,5 +25,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 |