From 715e0c915e6eea8017f32f8f2dc25d84a924b776 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 5 Dec 2015 08:20:27 +0100 Subject: [PATCH 1/2] t0080: improve last tests License: MIT Signed-off-by: Christian Couder --- test/sharness/t0080-repo.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/sharness/t0080-repo.sh b/test/sharness/t0080-repo.sh index fe0cf55b541..a1d3fa7bd03 100755 --- a/test/sharness/t0080-repo.sh +++ b/test/sharness/t0080-repo.sh @@ -197,11 +197,12 @@ test_expect_success "'ipfs refs --unique --recursive' is correct" ' echo "c1" > a/b/f1 && echo "c1" > a/b/c/f1 && echo "c2" > a/b/c/f2 && - ROOT=$(ipfs add -r -q a | tail -n1) && + ipfs add -r -q a >add_output && + ROOT=$(tail -n1 add_output) && ipfs refs --unique --recursive $ROOT >refs_output && wc -l refs_output | sed "s/^ *//g" >line_count && echo "4 refs_output" >expected && - test_cmp expected line_count + test_cmp expected line_count || test_fsh cat add_output || test_fsh cat refs_output ' test_expect_success "'ipfs refs --recursive (bigger)'" ' @@ -215,16 +216,19 @@ test_expect_success "'ipfs refs --recursive (bigger)'" ' cp -r b b2 && mv b2 b/b2 && cp -r b b3 && mv b3 b/b3 && cp -r b b4 && mv b4 b/b4 && - hash=$(ipfs add -r -q b | tail -n1) && - ipfs refs -r "$hash" | wc -l | sed "s/^ *//g" >actual && - echo "79" >expected && - test_cmp expected actual + ipfs add -r -q b >add_output && + hash=$(tail -n1 add_output) && + ipfs refs -r "$hash" >refs_output && + wc -l refs_output | sed "s/^ *//g" >actual && + echo "79 refs_output" >expected && + test_cmp expected actual || test_fsh cat add_output || test_fsh cat refs_output ' test_expect_success "'ipfs refs --unique --recursive (bigger)'" ' - ipfs refs -r "$hash" | sort | uniq >expected && - ipfs refs -r -u "$hash" | sort >actual && - test_cmp expected actual + ipfs refs -r "$hash" >refs_output && + sort refs_output | uniq >expected && + ipfs refs -r -u "$hash" >actual && + test_sort_cmp expected actual || test_fsh cat refs_output ' test_kill_ipfs_daemon From 0d7ef453f81f4681ace9951fba84659d1972fedb Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 5 Dec 2015 08:21:14 +0100 Subject: [PATCH 2/2] t0080: improve 'ipfs refs --unique' test License: MIT Signed-off-by: Christian Couder --- test/sharness/t0080-repo.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/sharness/t0080-repo.sh b/test/sharness/t0080-repo.sh index a1d3fa7bd03..56cd8476471 100755 --- a/test/sharness/t0080-repo.sh +++ b/test/sharness/t0080-repo.sh @@ -185,10 +185,11 @@ test_expect_success "'ipfs refs --unique' is correct" ' cd uniques && echo "content1" > file1 && echo "content1" > file2 && - ROOT=$(ipfs add -r -q . | tail -n1) && + ipfs add -r -q . > ../add_output && + ROOT=$(tail -n1 ../add_output) && ipfs refs --unique $ROOT >expected && ipfs add -q file1 >unique_hash && - test_cmp expected unique_hash + test_cmp expected unique_hash || test_fsh cat ../add_output ' test_expect_success "'ipfs refs --unique --recursive' is correct" '