Commit dd8d1430 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Have the Makefile be able to defer all of 'make check' to cmake

ie by running 'make check USE_CMAKE=1'

changed:
- defer to cmake for building the unittests
- building extensions doesn't use the rest of the build system so can remove
  that unnecessary dependency (would cause an llvm build otherwise).
parent fe075e7b
...@@ -20,8 +20,7 @@ pyston_release ...@@ -20,8 +20,7 @@ pyston_release
pyston_grwl pyston_grwl
pyston_grwl_dbg pyston_grwl_dbg
pyston_nosync pyston_nosync
/gc /*_unittest
/analysis
*.cache *.cache
tests/t.py tests/t.py
......
...@@ -317,14 +317,21 @@ NON_ENTRY_OBJS := $(filter-out src/jit.o,$(OBJS)) ...@@ -317,14 +317,21 @@ NON_ENTRY_OBJS := $(filter-out src/jit.o,$(OBJS))
define add_unittest define add_unittest
$(eval \ $(eval \
$1: $(GTEST_DIR)/src/gtest-all.o $(NON_ENTRY_OBJS) $(BUILD_SYSTEM_DEPS) $(UNITTEST_DIR)/$1.o ifneq ($(USE_CMAKE),1)
$1_unittest: $(GTEST_DIR)/src/gtest-all.o $(NON_ENTRY_OBJS) $(BUILD_SYSTEM_DEPS) $(UNITTEST_DIR)/$1.o
$(ECHO) Linking $$@ $(ECHO) Linking $$@
$(VERB) $(CXX) $(NON_ENTRY_OBJS) $(GTEST_DIR)/src/gtest-all.o $(GTEST_DIR)/src/gtest_main.o $(UNITTEST_DIR)/$1.o $(LDFLAGS) -o $$@ $(VERB) $(CXX) $(NON_ENTRY_OBJS) $(GTEST_DIR)/src/gtest-all.o $(GTEST_DIR)/src/gtest_main.o $(UNITTEST_DIR)/$1.o $(LDFLAGS) -o $$@
dbg_$1_unittests: $1 else
zsh -c 'ulimit -v $(MAX_MEM_KB); ulimit -d $(MAX_MEM_KB); time $(GDB) $(GDB_CMDS) --args ./$1 --gtest_break_on_failure $(ARGS)' .PHONY: $1_unittest
unittests:: $1 $1_unittest:
run_$1_unittests: $1 $(NINJA) -C $(HOME)/pyston-build-dbg $1_unittest $(NINJAFLAGS)
zsh -c 'ulimit -v $(MAX_MEM_KB); ulimit -d $(MAX_MEM_KB); time ./$1 $(ARGS)' ln -sf $(HOME)/pyston-build-dbg/$1_unittest .
endif
dbg_$1_unittests: $1_unittest
zsh -c 'ulimit -v $(MAX_MEM_KB); ulimit -d $(MAX_MEM_KB); time $(GDB) $(GDB_CMDS) --args ./$1_unittest --gtest_break_on_failure $(ARGS)'
unittests:: $1_unittest
run_$1_unittests: $1_unittest
zsh -c 'ulimit -v $(MAX_MEM_KB); ulimit -d $(MAX_MEM_KB); time ./$1_unittest $(ARGS)'
run_unittests:: run_$1_unittests run_unittests:: run_$1_unittests
) )
endef endef
...@@ -757,6 +764,7 @@ clean: ...@@ -757,6 +764,7 @@ clean:
@ find \( -name 'pyston*' -executable -type f \) -print -delete @ find \( -name 'pyston*' -executable -type f \) -print -delete
@ find $(TOOLS_DIR) -maxdepth 0 -executable -type f -print -delete @ find $(TOOLS_DIR) -maxdepth 0 -executable -type f -print -delete
@ rm -rf oprofile_data @ rm -rf oprofile_data
@ rm -f *_unittest
# A helper function that lets me run subdirectory rules from the top level; # A helper function that lets me run subdirectory rules from the top level;
# ex instead of saying "make tests/run_1", I can just write "make run_1" # ex instead of saying "make tests/run_1", I can just write "make run_1"
...@@ -934,9 +942,9 @@ TEST_EXT_MODULE_NAMES := basic_test descr_test slots_test ...@@ -934,9 +942,9 @@ TEST_EXT_MODULE_NAMES := basic_test descr_test slots_test
.PHONY: ext_pyston .PHONY: ext_pyston
ext_pyston: $(TEST_EXT_MODULE_NAMES:%=$(TEST_DIR)/test_extension/%.pyston.so) ext_pyston: $(TEST_EXT_MODULE_NAMES:%=$(TEST_DIR)/test_extension/%.pyston.so)
$(TEST_DIR)/test_extension/%.pyston.so: $(TEST_DIR)/test_extension/%.o $(BUILD_SYSTEM_DEPS) $(TEST_DIR)/test_extension/%.pyston.so: $(TEST_DIR)/test_extension/%.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro $< -o $@ -g gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro $< -o $@ -g
$(TEST_DIR)/test_extension/%.o: $(TEST_DIR)/test_extension/%.c $(wildcard ./include/*.h) $(BUILD_SYSTEM_DEPS) $(TEST_DIR)/test_extension/%.o: $(TEST_DIR)/test_extension/%.c $(wildcard ./include/*.h)
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Wimplicit -I./include -c $< -o $@ gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Wimplicit -I./include -c $< -o $@
.PHONY: ext_pyston_selfhost dbg_ext_pyston_selfhost ext_pyston_selfhost_release .PHONY: ext_pyston_selfhost dbg_ext_pyston_selfhost ext_pyston_selfhost_release
......
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