* [gentoo-commits] repo/gentoo:master commit in: eclass/tests/, /
@ 2023-05-15 7:58 Florian Schmaus
0 siblings, 0 replies; only message in thread
From: Florian Schmaus @ 2023-05-15 7:58 UTC (permalink / raw
To: gentoo-commits
commit: 94694a5c3710fe264e3726bc2dad379600f4ef2e
Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 15 13:42:59 2023 +0000
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Mon May 15 07:58:08 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94694a5c
eclass/tests: add Makefile to run eclass tests
Thanks to robbat2 for providing feedback.
Closes: https://github.com/gentoo/gentoo/pull/30603
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
.gitignore | 2 ++
eclass/tests/Makefile | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/.gitignore b/.gitignore
index fbf45aff6770..d79ada5b1b40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
/.ebuild.x
/distfiles/
/eclass/*.5
+/eclass/tests/*.sh.ok
+/eclass/tests/.eclasssum
/local/
/packages/
/profiles/use.local.desc
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-15 7:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-15 7:58 [gentoo-commits] repo/gentoo:master commit in: eclass/tests/, / Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox