1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00

Merge pull request #204137 from hercules-ci/fix-testBuildFailure-empty-last-log-line

testers.testBuildFailure: Read last log line without final newline
This commit is contained in:
Ryan Lahfa 2022-12-02 19:08:43 +01:00 committed by GitHub
commit fad052f056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -21,7 +21,7 @@ set -eu
echo "testBuildFailure: Expecting non-zero exit from builder and args: ${*@Q}"
("$@" 2>&1) | @coreutils@/bin/tee $TMPDIR/testBuildFailure.log \
| while read ln; do
| while IFS= read -r ln; do
echo "original builder: $ln"
done

View file

@ -29,15 +29,24 @@ lib.recurseIntoAttrs {
happy = runCommand "testBuildFailure-happy" {
failed = testers.testBuildFailure (runCommand "fail" {} ''
echo ok-ish >$out
echo failing though
echo also stderr 1>&2
echo 'line\nwith-\bbackslashes'
printf "incomplete line - no newline"
exit 3
'');
} ''
grep -F 'ok-ish' $failed/result
grep -F 'failing though' $failed/testBuildFailure.log
grep -F 'also stderr' $failed/testBuildFailure.log
grep -F 'ok-ish' $failed/result
grep -F 'line\nwith-\bbackslashes' $failed/testBuildFailure.log
grep -F 'incomplete line - no newline' $failed/testBuildFailure.log
[[ 3 = $(cat $failed/testBuildFailure.exit) ]]
touch $out
'';