From fe1ba2bf18568ee447c7e238a04f3c33f31f3857 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 8 Feb 2015 13:07:53 +0100 Subject: [PATCH 1/2] test: use multihash instead of shasum in tests As shasum is not installed on all machines and we use multihash anyway in the code base, it removes one dependency to use shasum instead of shasum in the tests. Now that there are sharness tests in multihash it is also safe to use it. License: MIT Signed-off-by: Christian Couder --- test/Makefile | 6 +++++- test/sharness/Makefile | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Makefile b/test/Makefile index f35aeb3eb..52f18d210 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,8 +1,9 @@ -BINS = bin/random bin/ipfs +BINS = bin/random bin/multihash bin/ipfs IPFS_ROOT = ../ IPFS_CMD = ../cmd/ipfs RANDOM_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-random +MULTIHASH_SRC = ../Godeps/_workspace/src/github.com/jbenet/go-multihash all: deps @@ -16,6 +17,9 @@ bins: $(BINS) bin/random: $(RANDOM_SRC)/**/*.go go build -o bin/random $(RANDOM_SRC)/random +bin/multihash: $(MULTIHASH_SRC)/**/*.go + go build -o bin/multihash $(MULTIHASH_SRC)/multihash + bin/ipfs: $(IPFS_ROOT)/**/*.go go build -o bin/ipfs $(IPFS_CMD) diff --git a/test/sharness/Makefile b/test/sharness/Makefile index 665484757..392826632 100644 --- a/test/sharness/Makefile +++ b/test/sharness/Makefile @@ -7,7 +7,7 @@ # NOTE: run with TEST_VERBOSE=1 for verbose sharness tests. T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) -BINS = bin/random bin/ipfs +BINS = bin/random bin/multihash bin/ipfs SHARNESS = lib/sharness/sharness.sh IPFS_ROOT = ../.. From 391b5a3c8907138b847087aa9b8ba6f4ca8f4b45 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 8 Feb 2015 13:32:42 +0100 Subject: [PATCH 2/2] t0040: use multihash instead of shasum in tests License: MIT Signed-off-by: Christian Couder --- test/sharness/t0040-add-and-cat.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/sharness/t0040-add-and-cat.sh b/test/sharness/t0040-add-and-cat.sh index 5f7e99118..a6e8efb6a 100755 --- a/test/sharness/t0040-add-and-cat.sh +++ b/test/sharness/t0040-add-and-cat.sh @@ -93,8 +93,8 @@ test_expect_success "generate 5MB file using go-random" ' ' test_expect_success "sha1 of the file looks ok" ' - echo "5620fb92eb5a49c9986b5c6844efda37e471660e mountdir/bigfile" >sha1_expected && - shasum mountdir/bigfile >sha1_actual && + echo "11145620fb92eb5a49c9986b5c6844efda37e471660e" >sha1_expected && + multihash -a=sha1 -e=hex mountdir/bigfile >sha1_actual && test_cmp sha1_expected sha1_actual ' @@ -128,8 +128,8 @@ test_expect_success EXPENSIVE "generate 100MB file using go-random" ' ' test_expect_success EXPENSIVE "sha1 of the file looks ok" ' - echo "885b197b01e0f7ff584458dc236cb9477d2e736d mountdir/bigfile" >sha1_expected && - shasum mountdir/bigfile >sha1_actual && + echo "1114885b197b01e0f7ff584458dc236cb9477d2e736d" >sha1_expected && + multihash -a=sha1 -e=hex mountdir/bigfile >sha1_actual && test_cmp sha1_expected sha1_actual ' @@ -144,7 +144,7 @@ test_expect_success EXPENSIVE "ipfs add bigfile output looks good" ' ' test_expect_success EXPENSIVE "ipfs cat succeeds" ' - ipfs cat $HASH | shasum >sha1_actual + ipfs cat $HASH | multihash -a=sha1 -e=hex >sha1_actual ' test_expect_success EXPENSIVE "ipfs cat output looks good" ' @@ -152,13 +152,13 @@ test_expect_success EXPENSIVE "ipfs cat output looks good" ' test_cmp mountdir/bigfile actual ' -test_expect_success EXPENSIVE "ipfs cat output shasum looks good" ' - echo "885b197b01e0f7ff584458dc236cb9477d2e736d -" >sha1_expected && +test_expect_success EXPENSIVE "ipfs cat output hashed looks good" ' + echo "1114885b197b01e0f7ff584458dc236cb9477d2e736d" >sha1_expected && test_cmp sha1_expected sha1_actual ' test_expect_success FUSE,EXPENSIVE "cat ipfs/bigfile succeeds" ' - cat ipfs/$HASH | shasum >sha1_actual + cat ipfs/$HASH | multihash -a=sha1 -e=hex >sha1_actual ' test_expect_success FUSE,EXPENSIVE "cat ipfs/bigfile looks good" '