test_gnunet_gns.sh 724 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. LOCATION=$(which gnunet-config)
  3. if [ -z $LOCATION ]
  4. then
  5. LOCATION="gnunet-config"
  6. fi
  7. $LOCATION --version
  8. if test $? != 0
  9. then
  10. echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
  11. exit 77
  12. fi
  13. trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
  14. ME=`whoami`
  15. if [ "$ME" != "root" ]
  16. then
  17. echo "This test only works if run as root. Skipping."
  18. exit 77
  19. fi
  20. export PATH=".:$PATH"
  21. gnunet-service-gns -c gns.conf &
  22. sleep 1
  23. LO=`nslookup alice.gnu | grep Address | tail -n1`
  24. if [ "$LO" != "Address: 1.2.3.4" ]
  25. then
  26. echo "Fail: $LO"
  27. fi
  28. LO=`nslookup www.bob.gnu | grep Address | tail -n1`
  29. if [ "$LO" != "Address: 4.5.6.7" ]
  30. then
  31. echo "Fail: $LO"
  32. fi
  33. kill `jobs -p`