X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fdht%2Ftest_dht_tools.sh;h=f83c26a1a615272be4f19e7fa920e3fc28e9532a;hb=f57cbab24fb7a22fc982eb8b6c4a2d18402be460;hp=d417ac09d2f2cec10047331cef82b7e531fdcba5;hpb=4bc45d875c581e9fc4549770dabe1b3f55011b15;p=oweals%2Fgnunet.git diff --git a/src/dht/test_dht_tools.sh b/src/dht/test_dht_tools.sh index d417ac09d..f83c26a1a 100755 --- a/src/dht/test_dht_tools.sh +++ b/src/dht/test_dht_tools.sh @@ -1,22 +1,35 @@ #!/bin/sh -armexe="gnunet-arm -c test_dht_api_peer1.conf " -putexe="gnunet-dht-put -c test_dht_api_peer1.conf " -getexe="gnunet-dht-get -c test_dht_api_peer1.conf " -out=`mktemp /tmp/test-gnunet-arm-logXXXXXXXX` +out=`mktemp /tmp/test-gnunet-dht-logXXXXXXXX` +tempcfg=`mktemp /tmp/test_dht_api_peer1.XXXXXXXX` checkout="check.out" - +armexe="gnunet-arm -c $tempcfg " +putexe="gnunet-dht-put -c $tempcfg " +getexe="gnunet-dht-get -c $tempcfg " +peerinfo="gnunet-peerinfo -c $tempcfg -sq" stop_arm() { - if ! $armexe $DEBUG -e > $out ; then + if ! $armexe $DEBUG -e -d > $out ; then echo "FAIL: error running $armexe" echo "Command output was:" cat $out - stop_arm + rm -f $out $tempcfg exit 1 fi + rm -f $out $tempcfg } +cp test_dht_api_peer1.conf $tempcfg + +echo -n "TEST: Generating hostkey..." +if ! $peerinfo > $out ; then + echo "FAIL: error running $peerinfo" + echo "Command output was:" + cat $out + exit 1 +fi +echo "PASS" + echo -n "TEST: Starting ARM..." if ! $armexe $DEBUG -s > $out ; then echo "FAIL: error running $armexe" @@ -29,7 +42,7 @@ echo "PASS" sleep 1 echo -n "TEST: Testing put..." -if ! $putexe -k testkey -d testdata > $out ; then +if ! $putexe -k testkey -d testdata -t 8 > $out ; then echo "FAIL: error running $putexe" echo "Command output was:" cat $out @@ -40,21 +53,21 @@ echo "PASS" sleep 1 echo -n "TEST: Testing get..." -echo "Result 0, type 0:" > $checkout +echo "Result 0, type 8:" > $checkout echo "testdata" >> $checkout -if ! $getexe -k testkey -T 1 > $out ; then +if ! $getexe -k testkey -T 5 -t 8 > $out ; then echo "FAIL: error running $putexe" echo "Command output was:" cat $out stop_arm exit 1 fi -if ! diff -q $out $checkout ; then + +if ! diff --strip-trailing-cr -q $out $checkout ; then echo "FAIL: $out and $checkout differ" stop_arm exit 1 fi echo "PASS" - stop_arm