From d0998a926d9832ee76da30516de914b1d6e378fd Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sat, 27 Jan 2018 13:28:34 -0800 Subject: [PATCH] make base64 decoding cross-platform support both the -D and the -d flag. License: MIT Signed-off-by: Steven Allen --- test/ipfs-test-lib.sh | 10 ++++++++++ test/sharness/t0170-dht.sh | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/test/ipfs-test-lib.sh b/test/ipfs-test-lib.sh index fc856df47..6c31c8380 100644 --- a/test/ipfs-test-lib.sh +++ b/test/ipfs-test-lib.sh @@ -109,3 +109,13 @@ test_seq() { i=$(expr "$i" + 1) done } + +b64decode() { + for flag in "-D" "-d"; do + if base64 "$flag" 2>/dev/null; then + return + fi + done + echo "no compatible base64 command found" >&2 + return 1 +} diff --git a/test/sharness/t0170-dht.sh b/test/sharness/t0170-dht.sh index 29a709d70..44a28f556 100755 --- a/test/sharness/t0170-dht.sh +++ b/test/sharness/t0170-dht.sh @@ -29,7 +29,7 @@ test_expect_success 'findpeer' ' # ipfs dht put test_expect_success 'put with good keys' ' - echo "$TEST_DHT_VALUE" | base64 -d | ipfsi 0 dht put "$TEST_DHT_PATH" | sort >putted && + echo "$TEST_DHT_VALUE" | b64decode | ipfsi 0 dht put "$TEST_DHT_PATH" | sort >putted && [ -s putted ] || test_fsh cat putted '