11# JLed unit tests Makefile
22# run `make coverage` to run all test and calculate coverage
3+ #
34.PHONY : phony
45
56CFLAGS=-std =c++14 -c -Wall -Wextra -I. -I../src -I./esp-idf \
@@ -10,29 +11,31 @@ CFLAGS=-std=c++14 -c -Wall -Wextra -I. -I../src -I./esp-idf \
1011
1112LDFLAGS =-fprofile-arcs -ftest-coverage
1213
13- TEST_ARDUINO_MOCK_SRC =Arduino.cpp test_arduino_mock.cpp test_main.cpp
14+ CATCH =catch2/catch_amalgamated.cpp
15+
16+ TEST_ARDUINO_MOCK_SRC =Arduino.cpp test_arduino_mock.cpp test_main.cpp ${CATCH}
1417TEST_ARDUINO_MOCK_OBJECTS=$(TEST_ARDUINO_MOCK_SRC:.cpp =.o)
1518
16- TEST_JLED_SRC =Arduino.cpp test_jled.cpp test_main.cpp ../src/jled_base.cpp
19+ TEST_JLED_SRC =Arduino.cpp test_jled.cpp test_main.cpp ../src/jled_base.cpp ${CATCH}
1720TEST_JLED_OBJECTS=$(TEST_JLED_SRC:.cpp =.o)
1821
19- TEST_JLED_SEQUENCE_SRC =Arduino.cpp test_jled_sequence.cpp test_main.cpp ../src/jled_base.cpp
22+ TEST_JLED_SEQUENCE_SRC =Arduino.cpp test_jled_sequence.cpp test_main.cpp ../src/jled_base.cpp ${CATCH}
2023TEST_JLED_SEQUENCE_OBJECTS=$(TEST_JLED_SEQUENCE_SRC:.cpp =.o)
2124
2225TEST_ESP32_SRC =esp-idf/esp_timer.cpp esp-idf/driver/ledc.cpp \
23- test_esp32_hal.cpp ../src/esp32_hal.cpp test_main.cpp
26+ test_esp32_hal.cpp ../src/esp32_hal.cpp test_main.cpp ${CATCH}
2427TEST_ESP32_OBJECTS=$(TEST_ESP32_SRC:.cpp =.o)
2528
26- TEST_ESP8266_SRC =Arduino.cpp test_esp8266_hal.cpp test_main.cpp
29+ TEST_ESP8266_SRC =Arduino.cpp test_esp8266_hal.cpp test_main.cpp ${CATCH}
2730TEST_ESP8266_OBJECTS=$(TEST_ESP8266_SRC:.cpp =.o)
2831
29- TEST_MBED_SRC =mbed.cpp test_mbed_hal.cpp test_main.cpp
32+ TEST_MBED_SRC =mbed.cpp test_mbed_hal.cpp test_main.cpp ${CATCH}
3033TEST_MBED_OBJECTS=$(TEST_MBED_SRC:.cpp =.o)
3134
32- TEST_ARDUINO_SRC =Arduino.cpp test_arduino_hal.cpp test_main.cpp
35+ TEST_ARDUINO_SRC =Arduino.cpp test_arduino_hal.cpp test_main.cpp ${CATCH}
3336TEST_ARDUINO_OBJECTS=$(TEST_ARDUINO_SRC:.cpp =.o)
3437
35- TEST_MORSE_SRC =test_example_morse.cpp test_main.cpp
38+ TEST_MORSE_SRC =test_example_morse.cpp test_main.cpp ${CATCH}
3639TEST_MORSE_OBJECTS=$(TEST_MORSE_SRC:.cpp =.o)
3740
3841
@@ -69,10 +72,10 @@ bin/test_example_morse: $(TEST_MORSE_OBJECTS)
6972 $(CXX ) -o $@ $(LDFLAGS ) $(TEST_MORSE_OBJECTS )
7073
7174coverage : test
72- lcov --config-file=.lcovrc --directory ../src --directory .. --capture --output-file coverage.info --no-external
73- lcov --config-file=.lcovrc --list coverage.info
75+ lcov --config-file=.lcovrc --directory ../src --directory .. --capture --output-file coverage.lcov --no-external
76+ lcov --config-file=.lcovrc --list coverage.lcov
7477 mkdir -p report
75- genhtml coverage.info -o report
78+ genhtml coverage.lcov -o report
7679
7780test : depend all
7881 ./bin/test_jled
9396 mkdir -p bin
9497
9598clean : phony
96- rm -f {./,esp-idf,esp-idf/driver}/{* .gcov,* .gcda,* .gcno,* .o} .depend
99+ rm -f {./,esp-idf,esp-idf/driver,catch2 }/{* .gcov,* .gcda,* .gcno,* .o} .depend
97100
98101clobber : clean
99102 rm -f bin/*
0 commit comments