diff mbox series

[1/2] Makefile: .gitlab-ci.yml: fail when listing tests fail

Message ID 20181021100303.18431-1-arnout@mind.be
State Accepted
Commit 70994768824bcc0889f7081b147b3de4cc58642e
Headers show
Series [1/2] Makefile: .gitlab-ci.yml: fail when listing tests fail | expand

Commit Message

Arnout Vandecappelle Oct. 21, 2018, 10:03 a.m. UTC
To update the .gitlab-ci.yml file, we run run-tests -l to list all the
tests and post-process the output in a format suitable for
.gitlab-ci.yml. However, in a pipeline, it is the last command that
gives the return value. In addition, we have to redirect stderr of
run-tests -l because nose2 prints the tests on stderr, not stdout. Thus,
when run-tests -l fails, the update of .gitlab-ci.yml silently succeeds
but no tests are included in the .gitlab-ci.yml.

To fix this, set tho pipefail option. This is bash-specific, but our
Makefile ascertains that we are running with bash as the shell (if bash
is available, but if it is not, dependencies.sh will error out). The
error message is still invisible, but at least make will fail.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Korsgaard Oct. 21, 2018, 9:33 p.m. UTC | #1
>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:

 > To update the .gitlab-ci.yml file, we run run-tests -l to list all the
 > tests and post-process the output in a format suitable for
 > .gitlab-ci.yml. However, in a pipeline, it is the last command that
 > gives the return value. In addition, we have to redirect stderr of
 > run-tests -l because nose2 prints the tests on stderr, not stdout. Thus,
 > when run-tests -l fails, the update of .gitlab-ci.yml silently succeeds
 > but no tests are included in the .gitlab-ci.yml.

 > To fix this, set tho pipefail option. This is bash-specific, but our

s/tho/the/

Committed, thanks.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 5c9b8a803b..83f5c6c994 100644
--- a/Makefile
+++ b/Makefile
@@ -1151,7 +1151,7 @@  check-package:
 .gitlab-ci.yml: .gitlab-ci.yml.in
 	cp $< $@
 	(cd configs; LC_ALL=C ls -1 *_defconfig) | sed 's/$$/: *defconfig/' >> $@
-	./support/testing/run-tests -l 2>&1 | sed -r -e '/^test_run \((.*)\).*/!d; s//\1: *runtime_test/' | LC_ALL=C sort >> $@
+	set -o pipefail; ./support/testing/run-tests -l 2>&1 | sed -r -e '/^test_run \((.*)\).*/!d; s//\1: *runtime_test/' | LC_ALL=C sort >> $@
 
 include docs/manual/manual.mk
 -include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(sort $(wildcard $(dir)/docs/*/*.mk)))