Bug 780448 - Add rules for generic python unit tests. r=ted

This commit is contained in:
Mike Hommey 2012-12-12 16:01:32 +01:00
parent 400ba91116
commit 7a281758d5
4 changed files with 33 additions and 27 deletions

View File

@ -103,6 +103,11 @@ 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/
@ -169,11 +174,6 @@ 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
@ -266,7 +266,4 @@ endif
GARBAGE += $(srcdir)/automationutils.pyc
# Test for ConfigStatus.py
check::
$(PYTHON) $(srcdir)/tests/unit-ConfigStatus.py
endif # ENABLE_TESTS

View File

@ -65,6 +65,8 @@ 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
@ -146,32 +148,13 @@ 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

View File

@ -112,6 +112,19 @@ 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

View File

@ -112,6 +112,19 @@ 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