summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-04-16 16:37:31 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-04-16 16:38:36 -0400
commite75f86a9f5f42147cd974b510d547eec6a1fc518 (patch)
tree8bf27119eb6bba2ec07799b35383145e4da44487
parent521ba651d7b6ae2c690b93b3ca10369a8c588d02 (diff)
downloadbfs-e75f86a9f5f42147cd974b510d547eec6a1fc518.tar.xz
tests: Also put build outputs under build/
-rw-r--r--.gitignore8
-rw-r--r--Makefile22
-rwxr-xr-xtests.sh3
3 files changed, 14 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index 1424907..76b7428 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,3 @@
.flags
-*.o
-*.d
-*.gcda
-*.gcno
+/build/
/bfs
-/tests/mksock
-/tests/trie
-/tests/xtimegm
diff --git a/Makefile b/Makefile
index 4b66c03..d2c0258 100644
--- a/Makefile
+++ b/Makefile
@@ -174,7 +174,7 @@ ALL_FLAGS := $(CC) : $(ALL_CFLAGS) : $(ALL_LDFLAGS) : $(ALL_LDLIBS)
$(shell ./flags.sh $(ALL_FLAGS))
# Goals that make binaries
-BIN_GOALS := bfs tests/mksock tests/trie tests/xtimegm
+BIN_GOALS := bfs build/tests/mksock build/tests/trie build/tests/xtimegm
# Goals that are treated like flags by this Makefile
FLAG_GOALS := asan lsan msan tsan ubsan gcov release
@@ -225,20 +225,20 @@ bfs: \
build/xspawn.o \
build/xtime.o
-tests/mksock: tests/mksock.o
-tests/trie: build/trie.o tests/trie.o
-tests/xtimegm: build/xtime.o tests/xtimegm.o
+build/tests/mksock: build/tests/mksock.o
+build/tests/trie: build/trie.o build/tests/trie.o
+build/tests/xtimegm: build/xtime.o build/tests/xtimegm.o
$(BIN_GOALS):
+$(CC) $(ALL_LDFLAGS) $^ $(ALL_LDLIBS) -o $@
-build:
+build build/tests:
$(MKDIR) $@
build/%.o: src/%.c .flags | build
$(CC) $(ALL_CFLAGS) -c $< -o $@
-
-tests/%.o: tests/%.c .flags
+
+build/tests/%.o: tests/%.c .flags | build/tests
$(CC) $(ALL_CFLAGS) -c $< -o $@
# Need a rule for .flags to convince make to apply the above pattern rule if
@@ -251,10 +251,10 @@ $(FLAG_GOALS): $(FLAG_PREREQS)
check: $(CHECKS)
-$(STRATEGY_CHECKS): check-%: bfs tests/mksock
+$(STRATEGY_CHECKS): check-%: bfs build/tests/mksock
./tests.sh --bfs="./bfs -S $*" $(TEST_FLAGS)
-check-trie check-xtimegm: check-%: tests/%
+check-trie check-xtimegm: check-%: build/tests/%
$<
distcheck:
@@ -269,7 +269,7 @@ endif
+$(MAKE) -B check $(DISTCHECK_FLAGS)
clean:
- $(RM) $(BIN_GOALS) .flags build/*.[od] *.gcda *.gcno tests/*.[od] tests/*.gcda tests/*.gcno
+ $(RM) -r bfs .flags build
install:
$(MKDIR) $(DESTDIR)$(PREFIX)/bin
@@ -288,4 +288,4 @@ uninstall:
.SUFFIXES:
--include $(wildcard build/*.d tests/*.d) \ No newline at end of file
+-include $(wildcard build/*.d build/tests/*.d)
diff --git a/tests.sh b/tests.sh
index 6d2c703..25fda36 100755
--- a/tests.sh
+++ b/tests.sh
@@ -881,6 +881,7 @@ ROOT=$(dirname -- "${BASH_SOURCE[0]}")
read -a BFS <<<"${BFS:-$ROOT/bfs}"
BFS[0]=$(_realpath "$(command -v "${BFS[0]}")")
+BUILD=$(_realpath "$ROOT/build")
TESTS=$(_realpath "$ROOT/tests")
# The temporary directory that will hold our test data
@@ -1053,7 +1054,7 @@ function make_rainbow() {
# TODO: block
ln -s /dev/null "$1/chardev_link"
ln -s nowhere "$1/broken"
- "$TESTS/mksock" "$1/socket"
+ "$BUILD/tests/mksock" "$1/socket"
touchp "$1"/s{u,g,ug}id
chmod u+s "$1"/su{,g}id
chmod g+s "$1"/s{u,}gid