pa1.2: add unit tests

This commit is contained in:
xinyangli 2024-01-13 10:38:20 +08:00
parent 9cca9de2a8
commit e19e89f70e
No known key found for this signature in database
8 changed files with 235 additions and 14 deletions

View file

@ -59,3 +59,14 @@ else
# Include rules to build NEMU
include $(NEMU_HOME)/scripts/native.mk
endif
.PHONY: test
include $(NEMU_HOME)/tests/Makefile
all-tests: TEST_OBJS = $(filter-out $(OBJ_DIR)/src/nemu-main.o, $(OBJS))
all-tests: CFLAGS += $(shell pkg-config --cflags check)
all-tests: LDFLAGS += $(shell pkg-config --libs check)
all-tests: $(TEST_SRCS:%.c=$(OBJ_DIR)/%)
test: all-tests
@$(OBJ_DIR)/tests/expr_test