summaryrefslogtreecommitdiff
path: root/build_test.mk
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-08-27 17:06:45 -0400
committerGitHub <noreply@github.com>2016-08-27 17:06:45 -0400
commit4fd5ac8326f491a347b8c049f32a3353a633ebf5 (patch)
treec82d8b5325ea82a7544489022afe00bf909495c3 /build_test.mk
parentf815b4871ebc5cc2f8d1a306eceec68c0a973a4c (diff)
parent922c4ea3bc46f6246d9f67ead11bcf53ff947ef3 (diff)
downloadqmk_firmware-4fd5ac8326f491a347b8c049f32a3353a633ebf5.tar.gz
qmk_firmware-4fd5ac8326f491a347b8c049f32a3353a633ebf5.zip
Merge pull request #690 from fredizzimo/unit_test
Add Unit Testing support
Diffstat (limited to 'build_test.mk')
-rw-r--r--build_test.mk57
1 files changed, 57 insertions, 0 deletions
diff --git a/build_test.mk b/build_test.mk
new file mode 100644
index 0000000000..ee15a45726
--- /dev/null
+++ b/build_test.mk
@@ -0,0 +1,57 @@
+ifndef VERBOSE
+.SILENT:
+endif
+
+.DEFAULT_GOAL := all
+
+include common.mk
+
+TARGET=test/$(TEST)
+
+GTEST_OUTPUT = $(BUILD_DIR)/gtest
+
+TEST_OBJ = $(BUILD_DIR)/test_obj
+
+OUTPUTS := $(TEST_OBJ)/$(TEST) $(GTEST_OUTPUT)
+
+GTEST_INC := \
+ $(LIB_PATH)/googletest/googletest/include\
+ $(LIB_PATH)/googletest/googlemock/include\
+
+GTEST_INTERNAL_INC :=\
+ $(LIB_PATH)/googletest/googletest\
+ $(LIB_PATH)/googletest/googlemock
+
+$(GTEST_OUTPUT)_SRC :=\
+ googletest/src/gtest-all.cc\
+ googletest/src/gtest_main.cc\
+ googlemock/src/gmock-all.cc
+
+$(GTEST_OUTPUT)_DEFS :=
+$(GTEST_OUTPUT)_INC := $(GTEST_INC) $(GTEST_INTERNAL_INC)
+
+LDFLAGS += -lstdc++ -lpthread -shared-libgcc
+CREATE_MAP := no
+
+VPATH +=\
+ $(LIB_PATH)/googletest\
+ $(LIB_PATH)/googlemock
+
+all: elf
+
+VPATH += $(COMMON_VPATH)
+
+include $(TMK_PATH)/common.mk
+include $(QUANTUM_PATH)/serial_link/tests/rules.mk
+
+$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
+$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
+$(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
+
+include $(TMK_PATH)/native.mk
+include $(TMK_PATH)/rules.mk
+
+
+$(shell mkdir -p $(BUILD_DIR)/test 2>/dev/null)
+$(shell mkdir -p $(TEST_OBJ) 2>/dev/null)
+