• [gentoo-dev] [PATCH] eclass/tests: add Makefile to run eclass tests

    From Florian Schmaus@21:1/5 to All on Sun Apr 23 15:20:01 2023
    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
    eclass/tests/.gitignore | 2 ++
    eclass/tests/Makefile | 27 +++++++++++++++++++++++++++
    2 files changed, 29 insertions(+)
    create mode 100644 eclass/tests/.gitignore
    create mode 100644 eclass/tests/Makefile

    diff --git a/eclass/tests/.gitignore b/eclass/tests/.gitignore
    new file mode 100644
    index 000000000000..4df21cab8f5f
    --- /dev/null
    +++ b/eclass/tests/.gitignore
    @@ -0,0 +1,2 @@
    +/*.sh.ok
    +/.eclasssum
    diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile
    new file mode 100644
    index 000000000000..f53f74cfc1af
    --- /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)
    +
    +.P