Skip to content

Commit

Permalink
tests: t6036-long-output-lines: portability changes
Browse files Browse the repository at this point in the history
Check for missing base64 program and fall back to openssl if not
found. Since `openssl base64` outputs in PEM format with newlines,
use tr(1) to remove newlines and then wrap at desired long line
length.
  • Loading branch information
grondo committed Jun 26, 2017
1 parent aa14687 commit dccca8a
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions tests/t6036-long-output-lines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@ Test that pdsh does not truncate very long lines'

. ${srcdir:-.}/test-lib.sh

test_expect_success 'pdsh does not truncate very long lines' '
dd if=/dev/urandom bs=1024 count=100 | base64 -w8000 > testfile &&
pdsh -w foo -N -Rexec cat testfile > output &&
test_cmp testfile output
'
test_expect_success 'pdsh does not truncate even longer lines' '
dd if=/dev/urandom bs=1024 count=100 | base64 -w80000 > testfile &&
if which base64 >/dev/null; then
base64="base64"
elif which openssl >/dev/null; then
base64="openssl base64"
else
skip_all 'failed to find base64 program'
fi


test_expect_success 'pdsh does not truncate very long lines' "
dd if=/dev/urandom bs=1024 count=100 | $base64 | tr -d '\n' | fold -w8000 > testfile &&
echo >>testfile &&
pdsh -w foo -N -Rexec cat testfile > output &&
test_cmp testfile output
'
"
test_expect_success 'pdsh does not truncate even longer lines' "
dd if=/dev/urandom bs=1024 count=100 | $base64 | tr -d '\n' | fold -w80000 > testfile2 &&
echo >>testfile2 &&
pdsh -w foo -N -Rexec cat testfile2 > output2 &&
test_cmp testfile2 output2
"

test_done

0 comments on commit dccca8a

Please sign in to comment.