From 99ffd120e8c67f090b6ff279beebe8912fbb0444 Mon Sep 17 00:00:00 2001 From: John Jones Date: Thu, 5 Oct 2017 13:36:23 -0500 Subject: [PATCH] Added test for transferring large files --- .gitignore | 5 +++++ test/scripts/test_1.sh | 8 ++++---- test/scripts/test_helpers.sh | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index ab89455..e8d8444 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,8 @@ .settings/language.settings.xml test/test_ipfs main/ipfs +test/test1.txt +test/test2.txt +test/scripts/hello.bin +test/scripts/hello2.bin +test/scripts/testlog.txt diff --git a/test/scripts/test_1.sh b/test/scripts/test_1.sh index 1bb2789..70264e5 100755 --- a/test/scripts/test_1.sh +++ b/test/scripts/test_1.sh @@ -24,7 +24,7 @@ function post { function body { retVal=0 - create_binary_file 512000; + create_binary_file 300000; eval "$IPFS" add hello.bin check_failure_with_exit "add hello.bin" $? @@ -33,12 +33,12 @@ function body { daemon_id=$! sleep 5 - eval "$IPFS" cat QmVGA3bXDJ41xoT621xQNzQgtBMQHj2AYxaunLBJtSoNgg > hello2.bin + eval "$IPFS" cat QmQY3qveNvosAgRhcgVVgkPPLZv4fpWuxhL3pfihzgKtTf > hello2.bin check_failure "cat" $? - # file size should be 512 + # file size should be 300000 actualsize=$(wc -c < hello2.bin) - if [ $actualsize -ne 512 ]; then + if [ $actualsize -ne 300000 ]; then echo '*** Failure *** file size incorrect' let retVal=1 fi diff --git a/test/scripts/test_helpers.sh b/test/scripts/test_helpers.sh index e747e16..225c32e 100755 --- a/test/scripts/test_helpers.sh +++ b/test/scripts/test_helpers.sh @@ -26,9 +26,9 @@ function create_binary_file { num_bytes=255; fi let num_bytes-- - for byte in `seq 0 $num_bytes`; + for ((byte=0;byte<=$num_bytes;byte++)); do - remainder=($byte % 255) + let remainder=($byte % 255) printf "\\$(printf "%o" $remainder)" >> hello.bin done }