Added test for transferring large files

This commit is contained in:
John Jones 2017-10-05 13:36:23 -05:00
parent 861ca0a332
commit 99ffd120e8
3 changed files with 11 additions and 6 deletions

5
.gitignore vendored
View file

@ -8,3 +8,8 @@
.settings/language.settings.xml .settings/language.settings.xml
test/test_ipfs test/test_ipfs
main/ipfs main/ipfs
test/test1.txt
test/test2.txt
test/scripts/hello.bin
test/scripts/hello2.bin
test/scripts/testlog.txt

View file

@ -24,7 +24,7 @@ function post {
function body { function body {
retVal=0 retVal=0
create_binary_file 512000; create_binary_file 300000;
eval "$IPFS" add hello.bin eval "$IPFS" add hello.bin
check_failure_with_exit "add hello.bin" $? check_failure_with_exit "add hello.bin" $?
@ -33,12 +33,12 @@ function body {
daemon_id=$! daemon_id=$!
sleep 5 sleep 5
eval "$IPFS" cat QmVGA3bXDJ41xoT621xQNzQgtBMQHj2AYxaunLBJtSoNgg > hello2.bin eval "$IPFS" cat QmQY3qveNvosAgRhcgVVgkPPLZv4fpWuxhL3pfihzgKtTf > hello2.bin
check_failure "cat" $? check_failure "cat" $?
# file size should be 512 # file size should be 300000
actualsize=$(wc -c < hello2.bin) actualsize=$(wc -c < hello2.bin)
if [ $actualsize -ne 512 ]; then if [ $actualsize -ne 300000 ]; then
echo '*** Failure *** file size incorrect' echo '*** Failure *** file size incorrect'
let retVal=1 let retVal=1
fi fi

View file

@ -26,9 +26,9 @@ function create_binary_file {
num_bytes=255; num_bytes=255;
fi fi
let num_bytes-- let num_bytes--
for byte in `seq 0 $num_bytes`; for ((byte=0;byte<=$num_bytes;byte++));
do do
remainder=($byte % 255) let remainder=($byte % 255)
printf "\\$(printf "%o" $remainder)" >> hello.bin printf "\\$(printf "%o" $remainder)" >> hello.bin
done done
} }