From 93aa8d0fb3901797b837a4c86cbe32657f1d2d10 Mon Sep 17 00:00:00 2001 From: Christian Couder <chriscool@tuxfamily.org> Date: Sun, 4 Oct 2015 00:18:43 +0200 Subject: [PATCH 1/4] t0220: check if 'ipfs bitswap' fails License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- test/sharness/t0220-bitswap.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/sharness/t0220-bitswap.sh b/test/sharness/t0220-bitswap.sh index 3632705b7..d4f757ebd 100755 --- a/test/sharness/t0220-bitswap.sh +++ b/test/sharness/t0220-bitswap.sh @@ -14,7 +14,8 @@ test_launch_ipfs_daemon test_expect_success "'ipfs block get' adds hash to wantlist" ' export NONEXIST=QmeXxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && test_expect_code 1 ipfs block get $NONEXIST --timeout=10ms && - ipfs bitswap wantlist | grep $NONEXIST + ipfs bitswap wantlist >wantlist_out && + grep $NONEXIST wantlist_out ' test_expect_success "'ipfs bitswap unwant' succeeds" ' From 7b81e4e88592042ac73481b82d5b24e838c97e1d Mon Sep 17 00:00:00 2001 From: Christian Couder <chriscool@tuxfamily.org> Date: Sun, 4 Oct 2015 00:13:30 +0200 Subject: [PATCH 2/4] t0220: use test_must_be_empty() License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- test/sharness/t0220-bitswap.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/sharness/t0220-bitswap.sh b/test/sharness/t0220-bitswap.sh index d4f757ebd..ac97a01de 100755 --- a/test/sharness/t0220-bitswap.sh +++ b/test/sharness/t0220-bitswap.sh @@ -24,8 +24,7 @@ test_expect_success "'ipfs bitswap unwant' succeeds" ' test_expect_success "hash was removed from wantlist" ' ipfs bitswap wantlist > wantlist_out && - printf "" > wantlist_exp && - test_cmp wantlist_out wantlist_exp + test_must_be_empty wantlist_out ' test_kill_ipfs_daemon From bf8adc6c6974ca2d45e975d2c5d0f6ba3124c7e8 Mon Sep 17 00:00:00 2001 From: Christian Couder <chriscool@tuxfamily.org> Date: Sat, 3 Oct 2015 22:54:23 +0200 Subject: [PATCH 3/4] t0044: fail when 'ipfs add' fails License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- test/sharness/t0044-add-symlink.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/sharness/t0044-add-symlink.sh b/test/sharness/t0044-add-symlink.sh index 4b38a7c22..f349fbceb 100755 --- a/test/sharness/t0044-add-symlink.sh +++ b/test/sharness/t0044-add-symlink.sh @@ -18,7 +18,8 @@ test_expect_success "creating files succeeds" ' test_add_symlinks() { test_expect_success "ipfs add files succeeds" ' - ipfs add -q -r files | tail -n 1 > filehash_out + ipfs add -q -r files >filehash_all && + tail -n 1 filehash_all >filehash_out ' test_expect_success "output looks good" ' From e499ee447025f7793702a2492101951fb119a6ce Mon Sep 17 00:00:00 2001 From: Christian Couder <chriscool@tuxfamily.org> Date: Sun, 4 Oct 2015 11:38:33 +0200 Subject: [PATCH 4/4] sharness: swap test_*cmp arguments License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- test/sharness/t0044-add-symlink.sh | 6 +++--- test/sharness/t0141-addfilter.sh | 2 +- test/sharness/x0045-add-cat-iptb.sh | 2 +- test/sharness/xt0130-multinode.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/sharness/t0044-add-symlink.sh b/test/sharness/t0044-add-symlink.sh index f349fbceb..a22e60f38 100755 --- a/test/sharness/t0044-add-symlink.sh +++ b/test/sharness/t0044-add-symlink.sh @@ -24,7 +24,7 @@ test_add_symlinks() { test_expect_success "output looks good" ' echo QmWdiHKoeSW8G1u7ATCgpx4yMoUhYaJBQGkyPLkS9goYZ8 > filehash_exp && - test_cmp filehash_out filehash_exp + test_cmp filehash_exp filehash_out ' test_expect_success "adding a symlink adds the link itself" ' @@ -33,7 +33,7 @@ test_add_symlinks() { test_expect_success "output looks good" ' echo "QmdocmZeF7qwPT9Z8SiVhMSyKA2KKoA2J7jToW6z6WBmxR" > goodlink_exp && - test_cmp goodlink_out goodlink_exp + test_cmp goodlink_exp goodlink_out ' test_expect_success "adding a broken symlink works" ' @@ -42,7 +42,7 @@ test_add_symlinks() { test_expect_success "output looks good" ' echo "QmWYN8SEXCgNT2PSjB6BnxAx6NJQtazWoBkTRH9GRfPFFQ" > badlink_exp && - test_cmp badlink_out badlink_exp + test_cmp badlink_exp badlink_out ' } diff --git a/test/sharness/t0141-addfilter.sh b/test/sharness/t0141-addfilter.sh index 37557f1da..4e31f3271 100755 --- a/test/sharness/t0141-addfilter.sh +++ b/test/sharness/t0141-addfilter.sh @@ -27,7 +27,7 @@ test_swarm_filter_cmd() { ' test_expect_success "'ipfs swarm filters' output looks good" ' - test_sort_cmp list_actual list_expected + test_sort_cmp list_expected list_actual ' } diff --git a/test/sharness/x0045-add-cat-iptb.sh b/test/sharness/x0045-add-cat-iptb.sh index feeee7cef..892c2f249 100755 --- a/test/sharness/x0045-add-cat-iptb.sh +++ b/test/sharness/x0045-add-cat-iptb.sh @@ -30,7 +30,7 @@ test_expect_success "cat that file on node2" ' test_expect_success "verify files match" ' multihash filea > expected1 && multihash fileb > actual1 && - test_cmp actual1 expected1 + test_cmp expected1 actual1 ' test_expect_success "shut down nodes" ' diff --git a/test/sharness/xt0130-multinode.sh b/test/sharness/xt0130-multinode.sh index 2d0cde475..0d2388238 100755 --- a/test/sharness/xt0130-multinode.sh +++ b/test/sharness/xt0130-multinode.sh @@ -30,7 +30,7 @@ test_expect_success "cat that file on node2" ' test_expect_success "verify files match" ' multihash filea > expected1 && multihash fileb > actual1 && - test_cmp actual1 expected1 + test_cmp expected1 actual1 ' test_expect_success "shut down nodes" '