mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
eclass/tests: Fail the .%.sh.ok Makefile recipe if the test fails
With .ONESHELL active, only the return status of the final recipe line will be checked. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
This commit is contained in:
@@ -2,18 +2,20 @@ SH_FILES := $(wildcard *.sh)
|
||||
TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES))
|
||||
TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES))
|
||||
|
||||
# !!! _All_ recipe lines for each target will be provided to a single
|
||||
# !!! invocation of the shell.
|
||||
.ONESHELL:
|
||||
|
||||
# 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 $@
|
||||
./$< && touch $@
|
||||
|
||||
.PHONY: test
|
||||
test: $(TEST_OK_FILES)
|
||||
|
||||
.PHONY: force
|
||||
.ONESHELL:
|
||||
.eclasssum: SHELL = /bin/bash
|
||||
.eclasssum: force
|
||||
set -euo pipefail
|
||||
|
||||
Reference in New Issue
Block a user