arm: add host uart driver tests
All host tests currently pass Some async refactors may not work well on device, will try later
This commit is contained in:
37
arm/makefile
37
arm/makefile
@@ -43,7 +43,7 @@ app.elf: $(app_objects) app.ld
|
||||
|
||||
deps = $(app_objects:.o=.d) $(bootloader_objects:.o=.d)
|
||||
|
||||
HOSTCXX = /usr/local/opt/llvm/bin/clang++
|
||||
HOSTCXX = clang++
|
||||
HOSTLDFLAGS = -lgmock -lgtest -lgtest_main -L/usr/local/opt/llvm/lib -L/usr/local/lib
|
||||
HOSTCFLAGS = -std=c++20 -g\
|
||||
-I/usr/local/opt/llvm/include \
|
||||
@@ -54,36 +54,39 @@ HOSTCFLAGS = -std=c++20 -g\
|
||||
TSAN_CFLAGS = $(HOSTCFLAGS) -fsanitize=thread
|
||||
ASAN_CFLAGS = $(HOSTCFLAGS) -fsanitize=address -fsanitize=leak
|
||||
|
||||
tests = ring_buffer_test async_test_asan async_test_tsan
|
||||
|
||||
.PRECIOUS: $(tests)
|
||||
tests = ring_buffer_test.run async_test_asan.run async_test_tsan.run uart_test_tsan.run
|
||||
|
||||
test: $(tests)
|
||||
|
||||
ring_buffer_test: ring_buffer_test.cc
|
||||
mkdir test
|
||||
$(HOSTCXX) $(HOSTCFLAGS) -o test/$@ $< $(HOSTLDFLAGS)
|
||||
./test/$@
|
||||
test/async_test_asan: async_test.cc async.host.o lock.host.o
|
||||
test/async_test_tsan: async_test.cc async.host.o lock.host.o
|
||||
test/ring_buffer_test: ring_buffer_test.cc lock.host.o
|
||||
test/uart_test_tsan: uart_test.cc fake_uart.host.o async.host.o lock.host.o
|
||||
|
||||
%.run: test/%
|
||||
TSAN_OPTIONS='suppressions=tsan.suppressions' ASAN_OPTIONS=detect_leaks=1 ./$<
|
||||
|
||||
%.host.o: %.cc
|
||||
$(HOSTCXX) $(HOSTCFLAGS) -c -o $@ $<
|
||||
|
||||
async_test_tsan: async_test.cc async.host.o
|
||||
mkdir -p test
|
||||
$(HOSTCXX) $(TSAN_CFLAGS) -o test/$@ $^ $(HOSTLDFLAGS)
|
||||
TSAN_OPTIONS='suppressions=tsan.suppressions' ./test/$@
|
||||
test/%_test: | mktest
|
||||
$(HOSTCXX) $(HOSTCFLAGS) -o $@ $^ $(HOSTLDFLAGS)
|
||||
|
||||
async_test_asan: async_test.cc async.host.o
|
||||
test/%_asan: | mktest
|
||||
$(HOSTCXX) $(ASAN_CFLAGS) -o $@ $^ $(HOSTLDFLAGS)
|
||||
|
||||
test/%_tsan: | mktest
|
||||
$(HOSTCXX) $(TSAN_CFLAGS) -o $@ $^ $(HOSTLDFLAGS)
|
||||
|
||||
mktest:
|
||||
mkdir -p test
|
||||
$(HOSTCXX) $(ASAN_CFLAGS) -o test/$@ $^ $(HOSTLDFLAGS)
|
||||
ASAN_OPTIONS=detect_leaks=1 ./test/$@
|
||||
|
||||
test_deps = async.host.d
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf *.elf *.bin $(app_objects) $(bootloader_objects) $(deps)
|
||||
rm -rf test/ *.dSYM $(tests) $(test_deps) *.o
|
||||
rm -rf test/ *.dSYM $(test_deps) *.o
|
||||
|
||||
-include $(deps)
|
||||
-include $(test_deps)
|
||||
-include $(test_deps)
|
Reference in New Issue
Block a user