summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-05-16 10:23:20 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-05-16 11:29:48 -0400
commitc13171fd7177c843e2e08417297babf99a365f1c (patch)
tree7b6654570d97abba4c0d96e1bbcf502df4ac54c8 /Makefile
parente49bf693efbe7ea54ac2c812c574cae1a09bbebf (diff)
downloadbfs-c13171fd7177c843e2e08417297babf99a365f1c.tar.xz
build: Make the tests a little less repetitive
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files 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"