From 1e077828cb8e259652fad66cebc47437608eb3d8 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 20 Nov 2014 20:03:41 +0100 Subject: [PATCH 1/4] Rename test_kill_ipfs_mount into test_kill_ipfs_daemon License: MIT Signed-off-by: Christian Couder --- test/lib/test-lib.sh | 2 +- test/t0030-mount.sh | 4 ++-- test/t0040-add-and-cat.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/lib/test-lib.sh b/test/lib/test-lib.sh index 54bdd6821..9b0586a91 100644 --- a/test/lib/test-lib.sh +++ b/test/lib/test-lib.sh @@ -100,7 +100,7 @@ test_kill_repeat_10_sec() { ! kill -0 $1 2>/dev/null } -test_kill_ipfs_mount() { +test_kill_ipfs_daemon() { test_expect_success FUSE "'ipfs daemon' is still running" ' kill -0 $IPFS_PID diff --git a/test/t0030-mount.sh b/test/t0030-mount.sh index 88e747598..cfc99bfcc 100755 --- a/test/t0030-mount.sh +++ b/test/t0030-mount.sh @@ -17,7 +17,7 @@ fi test_launch_ipfs_mount -test_kill_ipfs_mount +test_kill_ipfs_daemon test_expect_success "mount directories can be removed" ' rmdir ipfs ipns @@ -34,6 +34,6 @@ test_expect_failure "'ipfs mount' looks good when it fails (issue #341)" ' ! grep "IPNS mounted at" actual ' -test_kill_ipfs_mount +test_kill_ipfs_daemon test_done diff --git a/test/t0040-add-and-cat.sh b/test/t0040-add-and-cat.sh index 76ce00b76..18c56cb97 100755 --- a/test/t0040-add-and-cat.sh +++ b/test/t0040-add-and-cat.sh @@ -86,6 +86,6 @@ test_expect_success FUSE "cat ipfs/bigfile looks good" ' test_cmp sha1_expected sha1_actual ' -test_kill_ipfs_mount +test_kill_ipfs_daemon test_done From f06b9ca126d7a804ddfc64aa58884f72e962d414 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 20 Nov 2014 20:11:03 +0100 Subject: [PATCH 2/4] Rename test_launch_ipfs_mount into test_launch_ipfs_daemon_and_mount License: MIT Signed-off-by: Christian Couder --- test/lib/test-lib.sh | 2 +- test/t0030-mount.sh | 2 +- test/t0040-add-and-cat.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/lib/test-lib.sh b/test/lib/test-lib.sh index 9b0586a91..fce00583b 100644 --- a/test/lib/test-lib.sh +++ b/test/lib/test-lib.sh @@ -64,7 +64,7 @@ test_launch_ipfs_daemon() { ' } -test_launch_ipfs_mount() { +test_launch_ipfs_daemon_and_mount() { test_expect_success "ipfs init succeeds" ' export IPFS_DIR="$(pwd)/.go-ipfs" && diff --git a/test/t0030-mount.sh b/test/t0030-mount.sh index cfc99bfcc..3b3091e13 100755 --- a/test/t0030-mount.sh +++ b/test/t0030-mount.sh @@ -15,7 +15,7 @@ if ! test_have_prereq FUSE; then test_done fi -test_launch_ipfs_mount +test_launch_ipfs_daemon_and_mount test_kill_ipfs_daemon diff --git a/test/t0040-add-and-cat.sh b/test/t0040-add-and-cat.sh index 18c56cb97..1be996861 100755 --- a/test/t0040-add-and-cat.sh +++ b/test/t0040-add-and-cat.sh @@ -8,7 +8,7 @@ test_description="Test add and cat commands" . lib/test-lib.sh -test_launch_ipfs_mount +test_launch_ipfs_daemon_and_mount test_expect_success "ipfs add succeeds" ' echo "Hello Worlds!" >mountdir/hello.txt && From c8e7a95644fb4d67ffddc4b4999339dbffdc10e6 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 20 Nov 2014 20:27:09 +0100 Subject: [PATCH 3/4] Add an EXPENSIVE prereq and use it in t0040 We add this prereq to tests with a 100MB file as they are slow on Travis CI. License: MIT Signed-off-by: Christian Couder --- test/lib/test-lib.sh | 1 + test/t0040-add-and-cat.sh | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/test/lib/test-lib.sh b/test/lib/test-lib.sh index fce00583b..c8437ff47 100644 --- a/test/lib/test-lib.sh +++ b/test/lib/test-lib.sh @@ -29,6 +29,7 @@ SHARNESS_LIB="lib/sharness/sharness.sh" # Please put go-ipfs specific shell functions below test "$TEST_NO_FUSE" != 1 && test_set_prereq FUSE +test "$TEST_EXPENSIVE" = 1 && test_set_prereq EXPENSIVE test_cmp_repeat_10_sec() { for i in 1 2 3 4 5 6 7 8 9 10 diff --git a/test/t0040-add-and-cat.sh b/test/t0040-add-and-cat.sh index 1be996861..cf5fbfc39 100755 --- a/test/t0040-add-and-cat.sh +++ b/test/t0040-add-and-cat.sh @@ -42,47 +42,45 @@ test_expect_success "go-random is installed" ' type random ' -test_expect_success "generate 100MB file using go-random" ' +test_expect_success EXPENSIVE "generate 100MB file using go-random" ' random 104857600 42 >mountdir/bigfile ' -test_expect_success "sha1 of the file looks ok" ' +test_expect_success EXPENSIVE "sha1 of the file looks ok" ' echo "885b197b01e0f7ff584458dc236cb9477d2e736d mountdir/bigfile" >sha1_expected && shasum mountdir/bigfile >sha1_actual && test_cmp sha1_expected sha1_actual ' -test_expect_success "ipfs add bigfile succeeds" ' +test_expect_success EXPENSIVE "ipfs add bigfile succeeds" ' ipfs add mountdir/bigfile >actual ' -test_expect_success "ipfs add bigfile output looks good" ' +test_expect_success EXPENSIVE "ipfs add bigfile output looks good" ' HASH="QmWXysX1oysyjTqd5xGM2T1maBaVXnk5svQv4GKo5PsGPo" && echo "added $HASH mountdir/bigfile" >expected && test_cmp expected actual ' -test_expect_success "ipfs cat succeeds" ' +test_expect_success EXPENSIVE "ipfs cat succeeds" ' ipfs cat $HASH | shasum >sha1_actual ' -# this test commented out to run faster. -# uncomment to produce and examine output -# test_expect_success "ipfs cat output looks good" ' -# ipfs cat $HASH >actual && -# test_cmp mountdir/bigfile actual -# ' +test_expect_success EXPENSIVE "ipfs cat output looks good" ' + ipfs cat $HASH >actual && + test_cmp mountdir/bigfile actual +' -test_expect_success "ipfs cat output shasum looks good" ' +test_expect_success EXPENSIVE "ipfs cat output shasum looks good" ' echo "885b197b01e0f7ff584458dc236cb9477d2e736d -" >sha1_expected && test_cmp sha1_expected sha1_actual ' -test_expect_success FUSE "cat ipfs/bigfile succeeds" ' +test_expect_success FUSE,EXPENSIVE "cat ipfs/bigfile succeeds" ' cat ipfs/$HASH | shasum >sha1_actual ' -test_expect_success FUSE "cat ipfs/bigfile looks good" ' +test_expect_success FUSE,EXPENSIVE "cat ipfs/bigfile looks good" ' test_cmp sha1_expected sha1_actual ' From 196651d5f5841300259320ae3a2bea67602106a5 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 20 Nov 2014 20:46:02 +0100 Subject: [PATCH 4/4] Add sharness mount tests with a 5 MB file These new tests are not marked EXPENSIVE as they should be fast enough even on Travis CI. License: MIT Signed-off-by: Christian Couder --- test/t0040-add-and-cat.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/t0040-add-and-cat.sh b/test/t0040-add-and-cat.sh index cf5fbfc39..bcec157ba 100755 --- a/test/t0040-add-and-cat.sh +++ b/test/t0040-add-and-cat.sh @@ -42,6 +42,42 @@ test_expect_success "go-random is installed" ' type random ' +test_expect_success "generate 5MB file using go-random" ' + random 5242880 41 >mountdir/bigfile +' + +test_expect_success "sha1 of the file looks ok" ' + echo "5620fb92eb5a49c9986b5c6844efda37e471660e mountdir/bigfile" >sha1_expected && + shasum mountdir/bigfile >sha1_actual && + test_cmp sha1_expected sha1_actual +' + +test_expect_success "'ipfs add bigfile' succeeds" ' + ipfs add mountdir/bigfile >actual +' + +test_expect_success "'ipfs add bigfile' output looks good" ' + HASH="Qmf2EnuvFQtpFnMJb5aoVPnMx9naECPSm8AGyktmEB5rrR" && + echo "added $HASH mountdir/bigfile" >expected && + test_cmp expected actual +' + +test_expect_success "'ipfs cat' succeeds" ' + ipfs cat $HASH >actual +' + +test_expect_success "'ipfs cat' output looks good" ' + test_cmp mountdir/bigfile actual +' + +test_expect_success FUSE "cat ipfs/bigfile succeeds" ' + cat ipfs/$HASH >actual +' + +test_expect_success FUSE "cat ipfs/bigfile looks good" ' + test_cmp mountdir/bigfile actual +' + test_expect_success EXPENSIVE "generate 100MB file using go-random" ' random 104857600 42 >mountdir/bigfile '