Bug 780448 - Add rules for generic python unit tests. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 12 Dec 2012 16:01:32 +0100
changeset 115787 53c35671c6c2f1c9c85aec6448fa43f815c27e8b
parent 115786 213b4178df8c757ad11c5ed35b98cb95aa383a1e
child 115788 a18d27e6d78addf4da0a1e387f7e76fae1ef204e
push id19542
push usermh@glandium.org
push dateWed, 12 Dec 2012 15:03:14 +0000
treeherdermozilla-inbound@53c35671c6c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs780448
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 780448 - Add rules for generic python unit tests. r=ted
build/Makefile.in
config/Makefile.in
config/rules.mk
js/src/config/rules.mk
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -98,16 +98,21 @@ endif
 endif
 
 # Put a useful .gdbinit in the bin directory, to be picked up automatically
 # by GDB when we debug executables there.
 GDBINIT_FILES := .gdbinit
 GDBINIT_DEST = $(FINAL_TARGET)
 INSTALL_TARGETS += GDBINIT
 
+PYTHON_UNIT_TESTS := \
+  tests/unit-ConfigStatus.py \
+  tests/test.py \
+  $(NULL)
+
 include $(topsrcdir)/config/rules.mk
 
 # we install to _leaktest/
 TARGET_DEPTH = ..
 include $(srcdir)/automation-build.mk
 
 _LEAKTEST_DIR = $(DEPTH)/_leaktest
 GARBAGE_DIRS += $(_LEAKTEST_DIR)
@@ -164,21 +169,16 @@ GARBAGE_DIRS += $(_VALGRIND_DIR)
 libs:: $(_VALGRIND_FILES)
 	$(INSTALL) $^ $(_VALGRIND_DIR)
 endif
 
 ifdef ENABLE_TESTS
 libs:: $(topsrcdir)/tools/rb/fix_stack_using_bpsyms.py
 	$(INSTALL) $< $(DIST)/bin
 
-# Unit tests for ManifestParser
-check::
-	$(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(srcdir) \
-	  $(srcdir)/tests/test.py
-
 ifeq ($(OS_ARCH),Darwin)
 libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
 	$(INSTALL) $< $(DIST)/bin
 
 # Basic unit tests for some stuff in the unify script
 check::
 # build x64/i386 binaries, and unify them
 	rm -f unify-test-x64 unify-test-i386 unify-test-universal
@@ -261,12 +261,9 @@ endif
 
 ifeq ($(OS_ARCH),Linux)
 libs:: $(topsrcdir)/tools/rb/fix-linux-stack.pl
 	$(INSTALL) $< $(DIST)/bin
 endif
 
 GARBAGE += $(srcdir)/automationutils.pyc
 
-# Test for ConfigStatus.py
-check::
-	$(PYTHON) $(srcdir)/tests/unit-ConfigStatus.py
 endif # ENABLE_TESTS
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -60,16 +60,18 @@ endif
 HEADERS_FILES = \
 	$(DEPTH)/mozilla-config.h \
 	$(srcdir)/nsStaticComponents.h \
 	$(NULL)
 HEADERS_DEST := $(DIST)/include
 HEADERS_TARGET := export
 INSTALL_TARGETS += HEADERS
 
+PYTHON_UNIT_TESTS := $(wildcard $(srcdir)/tests/unit-*.py)
+
 include $(topsrcdir)/config/rules.mk
 
 HOST_CFLAGS += -DUNICODE -D_UNICODE
 
 ifeq ($(OS_CONFIG),SunOS4.1)
 NSPR_CFLAGS	+= -I$(srcdir)/../nsprpub/pr/include/md
 endif
 
@@ -141,42 +143,23 @@ ifndef CROSS_COMPILE
 ifdef USE_ELF_DYNSTR_GC
 elf-dynstr-gc: elf-dynstr-gc.c $(GLOBAL_DEPS) $(call mkdir_deps,$(MDDEPDIR))
 	$(CC) $(COMPILE_CFLAGS) $(GLIB_CFLAGS) -o $@ $< $(LDFLAGS) $(GLIB_LIBS)
 endif
 endif
 
 FORCE:
 
-PYUNITS := \
-  unit-Expression.py \
-  unit-Preprocessor.py \
-  unit-nsinstall.py \
-  unit-printprereleasesuffix.py \
-  unit-JarMaker.py \
-  unit-buildlist.py \
-  unit-expandlibs.py \
-  unit-writemozinfo.py \
-  unit-mozunit.py \
-  $(NULL)
-
 check-preqs = \
-  check-python-modules \
   check-jar-mn \
   check-makefiles \
   $(NULL)
 
 check:: $(check-preqs)
 
-check-python-modules::
-	@$(EXIT_ON_ERROR) \
-	for test in $(PYUNITS); do \
-	  $(PYTHON) $(srcdir)/tests/$$test ; \
-	done
-
 check-jar-mn::
 	$(MAKE) -C tests/src-simple check-jar
 	$(MAKE) -C tests/src-simple check-flat
 	$(MAKE) -C tests/src-simple check-flat USE_EXTENSION_MANIFEST=1
 ifneq (,$(filter-out WINNT OS2,$(OS_ARCH)))
 	$(MAKE) -C tests/src-simple check-symlink
 endif
 
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -107,16 +107,29 @@ LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS
 
 check::
 	@$(PYTHON) $(topsrcdir)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS))
 
 endif # CPP_UNIT_TESTS
 
 .PHONY: check
 
+ifdef PYTHON_UNIT_TESTS
+
+RUN_PYTHON_UNIT_TESTS := $(addprefix run-,$(PYTHON_UNIT_TESTS))
+
+.PHONY: $(RUN_PYTHON_UNIT_TESTS)
+
+check:: $(RUN_PYTHON_UNIT_TESTS)
+
+$(RUN_PYTHON_UNIT_TESTS): run-%: %
+	@PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $<
+
+endif # PYTHON_UNIT_TESTS
+
 endif # ENABLE_TESTS
 
 
 #
 # Library rules
 #
 # If FORCE_STATIC_LIB is set, build a static library.
 # Otherwise, build a shared library.
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -107,16 +107,29 @@ LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS
 
 check::
 	@$(PYTHON) $(topsrcdir)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS))
 
 endif # CPP_UNIT_TESTS
 
 .PHONY: check
 
+ifdef PYTHON_UNIT_TESTS
+
+RUN_PYTHON_UNIT_TESTS := $(addprefix run-,$(PYTHON_UNIT_TESTS))
+
+.PHONY: $(RUN_PYTHON_UNIT_TESTS)
+
+check:: $(RUN_PYTHON_UNIT_TESTS)
+
+$(RUN_PYTHON_UNIT_TESTS): run-%: %
+	@PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $<
+
+endif # PYTHON_UNIT_TESTS
+
 endif # ENABLE_TESTS
 
 
 #
 # Library rules
 #
 # If FORCE_STATIC_LIB is set, build a static library.
 # Otherwise, build a shared library.