1{
2 octave,
3 runCommand,
4}:
5package:
6
7runCommand "${package.name}-pkg-test"
8 {
9 nativeBuildInputs = [
10 (octave.withPackages (os: [ package ]))
11 ];
12 }
13 ''
14 { octave-cli --eval 'pkg test ${package.pname}' || touch FAILED_ERRCODE; } \
15 |& tee >( grep --quiet '^Failure Summary:$' && touch FAILED_OUTPUT || : ; cat >/dev/null )
16 if [[ -f FAILED_ERRCODE ]]; then
17 echo >&2 "octave-cli returned with non-zero exit code."
18 false
19 elif [[ -f FAILED_OUTPUT ]]; then
20 echo >&2 "Test failures detected in output."
21 false
22 else
23 touch $out
24 fi
25 ''