summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-05-15 10:03:16 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-05-15 10:03:16 +0100
commitd57892fd8c8d84b85e73005a433f66d85da12fa3 (patch)
tree6f735debac848918a243f90ae2fa6a2fb69e77ad /eclass/tests
parent4a7e8a04f36caa88d1996b1dcdedb196bb4beb2f (diff)
gentoo auto-resync : 15:05:2023 - 10:03:16
Diffstat (limited to 'eclass/tests')
-rw-r--r--eclass/tests/Makefile27
1 files changed, 27 insertions, 0 deletions
diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile
new file mode 100644
index 000000000000..ee4a454912c3
--- /dev/null
+++ b/eclass/tests/Makefile
@@ -0,0 +1,27 @@
+SH_FILES := $(wildcard *.sh)
+TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES))
+TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES))
+
+# We cache a successful test result if the testfile itself did not
+# change (%.sh) and the contents of the eclass/ directory did not
+# change (.eclasssum).
+.%.sh.ok: %.sh .eclasssum
+ ./$<
+ touch $@
+
+.PHONY: test
+test: $(TEST_OK_FILES)
+
+.PHONY: force
+.ONESHELL:
+.eclasssum: SHELL = /bin/bash
+.eclasssum: force
+ set -euo pipefail
+ find .. -maxdepth 1 -type f -name "*.eclass" \
+ -exec stat --format="%n %y" \{} \+ |\
+ sort |\
+ cksum - > $@.cur
+ trap "rm -f $@.cur" EXIT
+ if ! cmp --silent $@.cur $@; then
+ mv $@.cur $@
+ fi