Using set -e in .gitlab/ci.sh doesn't work as intended
If you check the CI log you will find this section of the log from test_hadrian
:
=====> 2 of 2 [0, 0, 0]
=====> 2 of 2 [0, 0, 0]
Compile failed (exit code 127) errors were:
/bin/sh: 1: /builds/ghc/ghc/_build/stage1-test/bin/ghc: not found
*** unexpected failure for T2632(normal)
Compile failed (exit code 127) errors were:
/bin/sh: 1: /builds/ghc/ghc/_build/stage1-test/bin/ghc: not found
*** unexpected failure for T13609(normal)
Performance Metrics (test environment: x86_64-linux-deb10-perf):
None collected.
Unexpected results from:
TEST="T13609 T2632"
SUMMARY for test run started at Wed Apr 6 18:01:47 2022
0:00:00.017100 spent to go through
2 total tests, which gave rise to
8 test cases, of which
6 were skipped
0 had missing libraries
0 expected passes
0 expected failures
0 caused framework failures
0 caused framework warnings
0 unexpected passes
2 unexpected failures
0 unexpected stat failures
0 fragile tests
Unexpected failures:
/builds/ghc/ghc/tmp/ghctest-hxd2n5g5/test spaces/testsuite/tests/stage1/T13609.run T13609 [exit code non-0] (normal)
/builds/ghc/ghc/tmp/ghctest-hxd2n5g5/test spaces/testsuite/tests/stage1/T2632.run T2632 [exit code non-0] (normal)
Appending 0 stats to file: /builds/ghc/ghc/performance-metrics.tsv
user error (tests failed)
Build failed.
[0;31mhadrian/build-cabal --flavour=perf -j8 --broken-test= --bignum=gmp test --test-root-dirs=testsuite/tests/stage1 --test-compiler=stage1 runtest.opts+=--ignore-perf-failures=all failed[0m
[1;34mRunning *@...[0m
/builds/ghc/ghc/.gitlab/common.sh: line 48: *@: command not found
[0;31m*@ failed[0m
[1;34mRunning *@...[0m
/builds/ghc/ghc/.gitlab/common.sh: line 48: *@: command not found
[0;31m*@ failed[0m
[1 of 2] Compiling Main ( proftest.hs, proftest.o )
[2 of 2] Linking proftest
[1;34mRunning hadrian/build-cabal --flavour=perf -j8 --broken-test= --bignum=gmp test --summary-junit=./junit.xml --test-have-intree-files --test-compiler=/builds/ghc/ghc/_build/install/bin/ghc runtest.opts+=--ignore-perf-failures=all...[0m
What is happening here:
- We run the stage1 tests which fail (#21072 (closed))
- There is this error /builds/ghc/ghc/.gitlab/common.sh: line 48: *@: command not found, which is caused by a bug in the
shell
function.
So three different commands fail here but are not caught by set -e, the solution appears to be add explicit error handling to the commands which may fail. (http://mywiki.wooledge.org/BashFAQ/105)