03-c-dry-run-fake-keyfile.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. ### Constants
  3. c_valgrind_min=1
  4. samplefile=${scriptdir}/test_tarsnap.sh
  5. out_stats_stderr=${s_basename}-output-stats.stderr
  6. keyfile=${scriptdir}/fake.keys
  7. cachedir=${s_basename}-cachedir
  8. init_cache_stderr=${s_basename}-cachedir.stderr
  9. scenario_cmd() {
  10. # Create a cache directory.
  11. setup_check "check --initialize-cachedir"
  12. ${c_valgrind_cmd} ./tarsnap --no-default-config \
  13. --keyfile "${keyfile}" --cachedir "${cachedir}" \
  14. --initialize-cachedir \
  15. 2> "${init_cache_stderr}"
  16. echo $? > "${c_exitfile}"
  17. setup_check "check --initialize-cachedir output"
  18. grep -q "created for" "${init_cache_stderr}"
  19. echo $? > "${c_exitfile}"
  20. # Check -c --dry-run --print-stats. The precise stats
  21. # will vary based on the system, so we can't check those.
  22. # (This uses more code than a --dry-run without any keyfile.)
  23. setup_check "check -c --dry-run with fake key"
  24. ${c_valgrind_cmd} ./tarsnap --no-default-config \
  25. --keyfile "${keyfile}" --cachedir "${cachedir}" \
  26. -c --dry-run --print-stats \
  27. "${samplefile}" \
  28. 2> "${out_stats_stderr}"
  29. echo $? > "${c_exitfile}"
  30. setup_check "check -c --dry-run with fake key output"
  31. grep -q "tarsnap: Removing leading" "${out_stats_stderr}"
  32. echo $? > "${c_exitfile}"
  33. }