test_cmdline.sh 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. umask 077
  3. set -e
  4. if [ $# -ge 1 ]; then
  5. TOR_BINARY="${1}"
  6. shift
  7. else
  8. TOR_BINARY="${TESTING_TOR_BINARY:-./src/app/tor}"
  9. fi
  10. echo "TOR BINARY IS ${TOR_BINARY}"
  11. die() { echo "$1" >&2 ; exit 5; }
  12. echo "A"
  13. DATA_DIR=$(mktemp -d -t tor_cmdline_tests.XXXXXX)
  14. trap 'rm -rf "$DATA_DIR"' 0
  15. # 1. Test list-torrc-options.
  16. OUT="${DATA_DIR}/output"
  17. echo "B"
  18. "${TOR_BINARY}" --list-torrc-options > "$OUT"
  19. echo "C"
  20. # regular options are given.
  21. grep -i "SocksPort" "$OUT" >/dev/null || die "Did not find SocksPort"
  22. echo "D"
  23. # unlisted options are given, since they do not have the NOSET flag.
  24. grep -i "__SocksPort" "$OUT" > /dev/null || die "Did not find __SocksPort"
  25. echo "E"
  26. # unsettable options are not given.
  27. if grep -i "DisableIOCP" "$OUT" /dev/null; then
  28. die "Found DisableIOCP"
  29. fi
  30. if grep -i "HiddenServiceOptions" "$OUT" /dev/null ; then
  31. die "Found HiddenServiceOptions"
  32. fi
  33. echo "OK"