Commit 9650d081 authored by Marek Vavrusa's avatar Marek Vavrusa

makefile: support for parallel runs

parent 421a66cf
......@@ -10,6 +10,14 @@ ifeq ($(PLATFORM),Darwin)
LIBEXT := .dylib
endif
# Find all sub-targets
TARGETS := $(TESTS)
ifeq (,$(findstring .rpl,$(TESTS)))
TARGETS := $(wildcard $(TESTS)/*.rpl)
endif
SOURCES := $(TARGETS)
TARGETS := $(patsubst %.rpl,%.out,$(SOURCES))
# Dependencies
include platform.mk
libcwrap_DIR := contrib/libswrap
......@@ -29,10 +37,15 @@ else
preload_syms := LD_PRELOAD="$(libfaketime):$(libcwrap)"
endif
all: depend
$(preload_syms) ./deckard.py $(TESTS) $(DAEMON) $(TEMPLATE) $(CONFIG) $(ADDITIONAL)
# Targets
all: $(TARGETS)
depend: $(libfaketime) $(libcwrap)
# Generic rule to run test
$(SOURCES): depend
%.out: %.rpl
@$(preload_syms) python $(abspath ./deckard.py) $< $(DAEMON) $(TEMPLATE) $(CONFIG) $(ADDITIONAL)
# Synchronize submodules
$(libfaketime_DIR)/Makefile:
@git submodule update --init
......@@ -41,7 +54,7 @@ $(libfaketime): $(libfaketime_DIR)/Makefile
$(libcwrap_DIR):
@git submodule update --init
$(libcwrap_cmake_DIR):$(libcwrap_DIR)
mkdir $(libcwrap_cmake_DIR)
@mkdir $(libcwrap_cmake_DIR)
$(libcwrap_cmake_DIR)/Makefile: $(libcwrap_cmake_DIR)
@cd $(libcwrap_cmake_DIR); cmake ..
$(libcwrap): $(libcwrap_cmake_DIR)/Makefile
......
......@@ -19,24 +19,18 @@ class Test:
if planned == 0:
return
print('[==========] Running %d test(s).' % planned)
for name, test_callback, args in self.tests:
print('[ RUN ] %s' % name)
try:
test_callback(*args)
passed += 1
print('[ OK ] %s' % name)
print('[ OK ] %s' % name)
except Exception as e:
print('[ FAIL ] %s (%s)' % (name, str(e)))
if 'VERBOSE' in os.environ:
print(traceback.format_exc())
print('[ FAIL ] %s (%s)' % (name, str(e)))
print(traceback.format_exc())
# Clear test set
self.tests = []
print('[==========] %d test(s) run.' % planned)
if passed == planned:
print('[ PASSED ] %d test(s).' % passed)
return 0
else:
print('[ FAILED ] %d test(s).' % (planned - passed))
return 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment