2
0

test_gnunet_gns.sh.in 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # This file is in the public domain.
  3. # test -z being correct was a false assumption here.
  4. # I have no executable 'fooble', but this will
  5. # return 1:
  6. # if test -z "`which fooble`"; then echo 1; fi
  7. # The command builtin might not work with busybox's ash
  8. # but this works for now.
  9. dir=$(dirname "$0")
  10. if test -e @PKGDATADIRECTORY@/existence.sh
  11. then
  12. . @PKGDATADIRECTORY@/existence.sh
  13. else
  14. . $dir/../../contrib/build-common/sh/lib.sh/existence.sh
  15. fi
  16. LOCATION=`existence gnunet-config`
  17. if test -z $LOCATION; then
  18. LOCATION="gnunet-config"
  19. fi
  20. $LOCATION --version
  21. if test $? != 0
  22. then
  23. echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
  24. exit 77
  25. fi
  26. trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
  27. ME=`whoami`
  28. if [ "$ME" != "root" ]
  29. then
  30. echo "This test only works if run as root. Skipping."
  31. exit 77
  32. fi
  33. export PATH=".:$PATH"
  34. gnunet-service-gns -c gns.conf &
  35. sleep 1
  36. LO=`nslookup alice.gnu | grep Address | tail -n1`
  37. if [ "$LO" != "Address: 1.2.3.4" ]
  38. then
  39. echo "Fail: $LO"
  40. fi
  41. LO=`nslookup www.bob.gnu | grep Address | tail -n1`
  42. if [ "$LO" != "Address: 4.5.6.7" ]
  43. then
  44. echo "Fail: $LO"
  45. fi
  46. # XXX: jobs. a builtin by bash, netbsd sh, maybe leave it be for now.
  47. kill `jobs -p`