From c13171fd7177c843e2e08417297babf99a365f1c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 16 May 2023 10:23:20 -0400 Subject: build: Make the tests a little less repetitive --- Makefile | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 7113bc4..f0e4e1e 100644 --- a/Makefile +++ b/Makefile @@ -189,13 +189,7 @@ $(FLAG_GOALS): $(FLAG_PREREQS) @: .PHONY: $(FLAG_GOALS) -all: \ - $(BIN)/bfs \ - $(BIN)/tests/bfstd \ - $(BIN)/tests/mksock \ - $(BIN)/tests/trie \ - $(BIN)/tests/xtimegm \ - $(BIN)/tests/xtouch +all: bfs tests .PHONY: all $(BIN)/%: @@ -245,31 +239,35 @@ LIBBFS := \ # The main executable $(BIN)/bfs: $(OBJ)/src/main.o $(LIBBFS) -# Standalone binary tests -STANDALONE_CHECKS := check-bfstd check-trie check-xtimegm +# Standalone unit tests +UNITS := bfstd trie xtimegm +UNIT_TESTS := $(UNITS:%=$(BIN)/tests/%) +UNIT_CHECKS := $(UNITS:%=check-%) + +# Testing utilities +TEST_UTILS := $(BIN)/tests/mksock $(BIN)/tests/xtouch + +tests: $(UNIT_TESTS) $(TEST_UTILS) +.PHONY: tests + +$(UNIT_TESTS): $(BIN)/tests/%: $(OBJ)/tests/%.o $(LIBBFS) # The different search strategies that we test STRATEGIES := bfs dfs ids eds STRATEGY_CHECKS := $(STRATEGIES:%=check-%) # All the different checks we run -CHECKS := $(STANDALONE_CHECKS) $(STRATEGY_CHECKS) +CHECKS := $(UNIT_CHECKS) $(STRATEGY_CHECKS) check: $(CHECKS) .PHONY: check $(CHECKS) -$(STANDALONE_CHECKS): check-%: $(BIN)/tests/% +$(UNIT_CHECKS): check-%: $(BIN)/tests/% $< -$(STRATEGY_CHECKS): check-%: $(BIN)/bfs $(BIN)/tests/mksock $(BIN)/tests/xtouch +$(STRATEGY_CHECKS): check-%: $(BIN)/bfs $(TEST_UTILS) ./tests/tests.sh --bfs="$(BIN)/bfs -S $*" $(TEST_FLAGS) -$(BIN)/tests/bfstd: $(OBJ)/tests/bfstd.o $(LIBBFS) -$(BIN)/tests/mksock: $(OBJ)/tests/mksock.o $(LIBBFS) -$(BIN)/tests/trie: $(OBJ)/tests/trie.o $(LIBBFS) -$(BIN)/tests/xtimegm: $(OBJ)/tests/xtimegm.o $(LIBBFS) -$(BIN)/tests/xtouch: $(OBJ)/tests/xtouch.o $(LIBBFS) - # Custom test flags for distcheck DISTCHECK_FLAGS := -s TEST_FLAGS="--sudo --verbose=skipped" -- cgit v1.2.3