diff options
author | Florian Schmaus <flow@gentoo.org> | 2023-04-15 15:42:59 +0200 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2023-05-15 09:58:08 +0200 |
commit | 94694a5c3710fe264e3726bc2dad379600f4ef2e (patch) | |
tree | cd2d847501080b592b25d0a4c6be1b8049f81e42 /eclass | |
parent | eclass/ruby-ng.eclass: mark ruby27 as removed (diff) | |
download | gentoo-94694a5c3710fe264e3726bc2dad379600f4ef2e.tar.gz gentoo-94694a5c3710fe264e3726bc2dad379600f4ef2e.tar.bz2 gentoo-94694a5c3710fe264e3726bc2dad379600f4ef2e.zip |
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@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/tests/Makefile | 27 |
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 |