From fe742050acf7059ca91cf76661a80ea429aa56e3 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 29 Aug 2015 22:23:43 +0200 Subject: [PATCH 1/3] t0062: use "$@" directly This avoids potential quoting problems. License: MIT Signed-off-by: Christian Couder --- test/sharness/t0062-daemon-api.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/sharness/t0062-daemon-api.sh b/test/sharness/t0062-daemon-api.sh index a289ed3b1..d62869e87 100755 --- a/test/sharness/t0062-daemon-api.sh +++ b/test/sharness/t0062-daemon-api.sh @@ -16,16 +16,14 @@ api_fromcfg=$(ipfs config Addresses.API) peerid=$(ipfs config Identity.PeerID) test_client() { - args="$@" printf $peerid >expected - ipfs $args id -f="" >actual + ipfs "$@" id -f="" >actual test_cmp expected actual } test_client_must_fail() { - args="$@" echo "Error: api not running" >expected_err - test_must_fail ipfs $args id -f="" >actual 2>actual_err + test_must_fail ipfs "$@" id -f="" >actual 2>actual_err test_cmp expected_err actual_err } From cbeff099a2d55073af6c02779376671e57e4e859 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 29 Aug 2015 22:28:58 +0200 Subject: [PATCH 2/3] t0062: check that 'ipfs config' works License: MIT Signed-off-by: Christian Couder --- test/sharness/t0062-daemon-api.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/sharness/t0062-daemon-api.sh b/test/sharness/t0062-daemon-api.sh index d62869e87..8ba8faeb5 100755 --- a/test/sharness/t0062-daemon-api.sh +++ b/test/sharness/t0062-daemon-api.sh @@ -12,11 +12,14 @@ test_init_ipfs differentport=$((PORT_API + 1)) api_different="/ip4/127.0.0.1/tcp/$differentport" api_unreachable="/ip4/127.0.0.1/tcp/1" -api_fromcfg=$(ipfs config Addresses.API) -peerid=$(ipfs config Identity.PeerID) + +test_expect_success "config setup" ' + api_fromcfg=$(ipfs config Addresses.API) && + peerid=$(ipfs config Identity.PeerID) +' test_client() { - printf $peerid >expected + printf "$peerid" >expected ipfs "$@" id -f="" >actual test_cmp expected actual } From 3562e72d8eb09fc337d583f5936e7782cf8519c2 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 29 Aug 2015 22:30:37 +0200 Subject: [PATCH 3/3] t0062: add missing && in test_client*() License: MIT Signed-off-by: Christian Couder --- test/sharness/t0062-daemon-api.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sharness/t0062-daemon-api.sh b/test/sharness/t0062-daemon-api.sh index 8ba8faeb5..5cbdc460f 100755 --- a/test/sharness/t0062-daemon-api.sh +++ b/test/sharness/t0062-daemon-api.sh @@ -19,14 +19,14 @@ test_expect_success "config setup" ' ' test_client() { - printf "$peerid" >expected - ipfs "$@" id -f="" >actual + printf "$peerid" >expected && + ipfs "$@" id -f="" >actual && test_cmp expected actual } test_client_must_fail() { - echo "Error: api not running" >expected_err - test_must_fail ipfs "$@" id -f="" >actual 2>actual_err + echo "Error: api not running" >expected_err && + test_must_fail ipfs "$@" id -f="" >actual 2>actual_err && test_cmp expected_err actual_err }