Build actual tests, convert byte_stuffer_tests

This commit is contained in:
Fred Sundvik 2016-08-24 22:23:17 +03:00
parent 8a9aac6e32
commit 0a11460175
7 changed files with 181 additions and 181 deletions

View File

@ -155,12 +155,8 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
endif
ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
SERIAL_DIR = $(QUANTUM_DIR)/serial_link
SERIAL_PATH = $(QUANTUM_PATH)/serial_link
SERIAL_SRC = $(wildcard $(SERIAL_PATH)/protocol/*.c)
SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
OPT_DEFS += -DSERIAL_LINK_ENABLE
OPT_DEFS += $(SERIAL_DEFS)
VAPTH += $(SERIAL_PATH)
endif

View File

@ -10,7 +10,9 @@ TARGET=test/$(TEST)
GTEST_OUTPUT = $(BUILD_DIR)/gtest
OUTPUTS := $(GTEST_OUTPUT)
TEST_OBJ = $(BUILD_DIR)/test_obj
OUTPUTS := $(TEST_OBJ)/$(TEST) $(GTEST_OUTPUT)
GTEST_INC := \
$(LIB_PATH)/googletest/googletest/include\
@ -36,8 +38,16 @@ VPATH +=\
all: elf
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 $(BUILD_DIR)/test 2>/dev/null)
$(shell mkdir -p $(BUILD_DIR)/test 2>/dev/null)
$(shell mkdir -p $(TEST_OBJ) 2>/dev/null)

View File

@ -9,4 +9,18 @@ LIB_PATH = $(TOP_DIR)/lib
QUANTUM_DIR = quantum
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
BUILD_DIR := $(TOP_DIR)/.build
BUILD_DIR := $(TOP_DIR)/.build
SERIAL_DIR := $(QUANTUM_DIR)/serial_link
SERIAL_PATH := $(QUANTUM_PATH)/serial_link
SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
SERIAL_DEFS += -DSERIAL_LINK_ENABLE
VPATH += $(TOP_DIR)
VPATH += $(TMK_PATH)
VPATH += $(QUANTUM_PATH)
VPATH += $(QUANTUM_PATH)/keymap_extras
VPATH += $(QUANTUM_PATH)/audio
VPATH += $(QUANTUM_PATH)/process_keycode
VPATH += $(SERIAL_PATH)

View File

@ -31,9 +31,6 @@ SOFTWARE.
// https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
// http://www.stuartcheshire.org/papers/COBSforToN.pdf
#define MAX_FRAME_SIZE 1024
#define NUM_LINKS 2
typedef struct byte_stuffer_state {
uint16_t next_zero;
uint16_t data_pos;

View File

@ -27,6 +27,9 @@ SOFTWARE.
#include <stdint.h>
#define MAX_FRAME_SIZE 1024
#define NUM_LINKS 2
void init_byte_stuffer(void);
void byte_stuffer_recv_byte(uint8_t link, uint8_t data);
void byte_stuffer_send_frame(uint8_t link, uint8_t* data, uint16_t size);

View File

@ -0,0 +1,3 @@
serial_link_byte_stuffer_SRC :=\
$(SERIAL_PATH)/tests/byte_stuffer_tests.cpp \
$(SERIAL_PATH)/protocol/byte_stuffer.c