676f6fa
#!/bin/bash
676f6fa
676f6fa
shopt -s failglob
2e7d459
2e7d459
# Print output from failing tests
a245ca5
printf -v sep "%0.s-" {1..80}
2e7d459
for exit_file in t/test-results/*.exit; do
a245ca5
    [ "$(< "$exit_file")" -eq 0 ] && continue
2e7d459
    out_file="${exit_file%exit}out"
a245ca5
    printf '\n%s\n%s\n%s\n' "$sep" "$out_file" "$sep"
2e7d459
    cat "$out_file"
2e7d459
done
0af3adf
0af3adf
# tar up test-results & $testdir, then print base64 encoded output
0af3adf
#
0af3adf
# copy $testdir contents to test-results to avoid absolute paths with tar
0af3adf
cp -a $testdir/* t/test-results/
0af3adf
begin='-----BEGIN BASE64 MESSAGE-----'
0af3adf
end='-----END BASE64 MESSAGE-----'
0af3adf
printf '\n%s\n' 'test-results and trash directory output follows; decode via:'
0af3adf
printf '%s\n' "sed -n '/^${begin}$/,/^${end}$/{/^${begin}$/!{/^${end}$/!p}}' build.log | base64 -d >output.tar.zst"
0af3adf
printf '%s\n' "$begin"
0af3adf
tar -C t -cf - test-results/ | zstdmt -17 | base64
0af3adf
printf '%s\n' "$end"
0af3adf
2e7d459
exit 1