|
@@ -20,18 +20,23 @@ SOURCES := src/shellmatta.c \
|
|
|
|
|
|
INCLUDES := api .
|
|
INCLUDES := api .
|
|
|
|
|
|
-TEST_SOURCES := test/test_main.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_writeEcho.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_shellItoa.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_saveCursorPos.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_restoreCursorPos.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_eraseLine.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_rewindCursor.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_forwardCursor.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_clearInput.cpp \
|
|
|
|
- test/shellmatta_utils/test_utils_insertChars.cpp
|
|
|
|
-
|
|
|
|
-TEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(TEST_SOURCES))
|
|
|
|
|
|
+UNITTEST_SOURCES := test/unittest/test_main.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_writeEcho.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_shellItoa.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_saveCursorPos.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_restoreCursorPos.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_eraseLine.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_rewindCursor.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_forwardCursor.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_clearInput.cpp \
|
|
|
|
+ test/unittest/shellmatta_utils/test_utils_insertChars.cpp
|
|
|
|
+
|
|
|
|
+INTEGRATIONTEST_SOURCES := test/integrationtest/test_main.cpp \
|
|
|
|
+ test/integrationtest/test_integration.cpp
|
|
|
|
+
|
|
|
|
+UNITTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(UNITTEST_SOURCES))
|
|
|
|
+
|
|
|
|
+INTEGRATIONTEST_CPPOBJ := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(INTEGRATIONTEST_SOURCES))
|
|
|
|
|
|
CFLAGS := $(INCLUDES:%=-I%) -g
|
|
CFLAGS := $(INCLUDES:%=-I%) -g
|
|
TESTFLAGS := $(INCLUDES:%=-I%) -g -fprofile-arcs -ftest-coverage
|
|
TESTFLAGS := $(INCLUDES:%=-I%) -g -fprofile-arcs -ftest-coverage
|
|
@@ -46,9 +51,11 @@ EXAMPLE_COBJ := $(patsubst %.c,$(OBJ_DIR)%.o,$(EXAMPLE_SOURCES))
|
|
|
|
|
|
EXAMPLE_TARGET := $(OBJ_DIR)example/example
|
|
EXAMPLE_TARGET := $(OBJ_DIR)example/example
|
|
|
|
|
|
-TEST_TARGET := $(OBJ_DIR)test/test
|
|
|
|
|
|
+UNITTEST_TARGET := $(OBJ_DIR)test/unittest/unittest
|
|
|
|
+
|
|
|
|
+INTEGRATIONTEST_TARGET := $(OBJ_DIR)test/integrationtest/integrationtest
|
|
|
|
|
|
-OBJ := $(COBJ) $(EXAMPLE_COBJ) $(TEST_CPPOBJ)
|
|
|
|
|
|
+OBJ := $(COBJ) $(EXAMPLE_COBJ) $(UNITTEST_CPPOBJ) $(INTEGRATIONTEST_CPPOBJ)
|
|
DEPS := $(OBJ:%.o=%.d)
|
|
DEPS := $(OBJ:%.o=%.d)
|
|
|
|
|
|
export
|
|
export
|
|
@@ -60,14 +67,24 @@ help:
|
|
@echo example - build example
|
|
@echo example - build example
|
|
@echo -------------------------
|
|
@echo -------------------------
|
|
|
|
|
|
-test: $(TEST_TARGET)
|
|
|
|
- - @mkdir -p output/test/report
|
|
|
|
|
|
+test: unittest integrationtest
|
|
|
|
+
|
|
|
|
+unittest: $(UNITTEST_TARGET)
|
|
|
|
+ - @mkdir -p output/test/unittest/report
|
|
@echo running test:
|
|
@echo running test:
|
|
- -output/test/test
|
|
|
|
|
|
+ -$(UNITTEST_TARGET)
|
|
#gcov -o output/test $(TEST_CPPOBJ) -r
|
|
#gcov -o output/test $(TEST_CPPOBJ) -r
|
|
- gcovr --html-details --output output/test/report/report.html output/test -f src -f api
|
|
|
|
|
|
+ gcovr --html-details --output $(OBJ_DIR)test/unittest/report/report.html output/test/unittest -f src -f api
|
|
#-rm *.gcov
|
|
#-rm *.gcov
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+integrationtest: $(INTEGRATIONTEST_TARGET)
|
|
|
|
+ - @mkdir -p output/test/integrationtest/report
|
|
|
|
+ @echo running test:
|
|
|
|
+ -$(INTEGRATIONTEST_TARGET)
|
|
|
|
+ #gcov -o output/test $(TEST_CPPOBJ) -r
|
|
|
|
+ gcovr --html-details --output $(OBJ_DIR)test/integrationtest/report/report.html output/test/integrationtest -f src -f api
|
|
|
|
+ #-rm *.gcov
|
|
|
|
+
|
|
example: $(EXAMPLE_TARGET)
|
|
example: $(EXAMPLE_TARGET)
|
|
@echo building example
|
|
@echo building example
|
|
|
|
|
|
@@ -83,7 +100,11 @@ $(EXAMPLE_TARGET): $(COBJ) $(EXAMPLE_COBJ)
|
|
- @mkdir -p $(@D)
|
|
- @mkdir -p $(@D)
|
|
$(CC) $(LFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
|
|
$(CC) $(LFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
|
|
|
|
|
|
-$(TEST_TARGET): $(TEST_CPPOBJ)
|
|
|
|
|
|
+$(UNITTEST_TARGET): $(UNITTEST_CPPOBJ)
|
|
|
|
+ - @mkdir -p $(@D)
|
|
|
|
+ $(CPP) $(TESTLFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
|
|
|
|
+
|
|
|
|
+$(INTEGRATIONTEST_TARGET): $(INTEGRATIONTEST_CPPOBJ) $(COBJ)
|
|
- @mkdir -p $(@D)
|
|
- @mkdir -p $(@D)
|
|
$(CPP) $(TESTLFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
|
|
$(CPP) $(TESTLFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
|
|
|
|
|
|
@@ -101,7 +122,7 @@ $(EXAMPLE_COBJ):
|
|
@$(CC) -c $(CFLAGS) $(DEPEND) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
|
|
@$(CC) -c $(CFLAGS) $(DEPEND) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
|
|
$(CC) -c $(CFLAGS) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
|
|
$(CC) -c $(CFLAGS) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
|
|
|
|
|
|
-$(TEST_CPPOBJ):
|
|
|
|
|
|
+$(UNITTEST_CPPOBJ) $(INTEGRATIONTEST_CPPOBJ):
|
|
- @mkdir -p $(@D)
|
|
- @mkdir -p $(@D)
|
|
@$(CPP) -c $(TESTFLAGS) $(DEPEND) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.cpp))
|
|
@$(CPP) -c $(TESTFLAGS) $(DEPEND) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.cpp))
|
|
$(CPP) -c $(TESTFLAGS) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.cpp))
|
|
$(CPP) -c $(TESTFLAGS) -o $@ $(subst $(OBJ_DIR), ,$(@:%.o=%.cpp))
|