123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. . "$TF_DIR/include/subtest.sh"
  3. . "$TF_DIR/include/tools.sh"
  4. tf_enum_subtests() {
  5. echo unknown
  6. echo unknown_dash1
  7. echo unknown_dash2
  8. echo unknown_none
  9. echo unknown_same
  10. echo shellfu_path
  11. echo inigrep_path
  12. echo app_version
  13. echo cache_home
  14. echo libexec
  15. echo libexec_prefix
  16. # warn "unknown devel key: $key"
  17. }
  18. ckfuzzy() {
  19. local es
  20. local out="result/$name.stdout"
  21. mkdir -p result
  22. cat > "$out"
  23. case "$name" in
  24. shellfu_path) grep -q '^/usr/' ;;
  25. inigrep_path) grep -q '^/usr/' ;;
  26. app_version) grep -q '[0-9]' ;;
  27. cache_home) grep -qx '/home/.*/.cache/satcmd' ;;
  28. libexec) grep -q '^/usr/' ;;
  29. libexec_prefix) grep -q '.' ;;
  30. esac <"$out"; es=$?
  31. if test $es -gt 0;
  32. then
  33. tf_warn "bad output format"
  34. cat "$out"
  35. return "$TF_ES_FAIL"
  36. fi
  37. }
  38. tf_do_subtest() {
  39. local name=$1
  40. local o_err="oracle/$name.stderr"
  41. case $name in
  42. unknown) tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get-foo ;;
  43. unknown_dash1) tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get-- ;;
  44. unknown_dash2) tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get--- ;;
  45. unknown_none) tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get- ;;
  46. unknown_same) tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get---saturnin-get ;;
  47. shellfu_path) satcmd --saturnin-get-shellfu-path | ckfuzzy ;;
  48. inigrep_path) satcmd --saturnin-get-inigrep-path | ckfuzzy ;;
  49. app_version) satcmd --saturnin-get-app-version | ckfuzzy ;;
  50. cache_home) satcmd --saturnin-get-cache-home | ckfuzzy ;;
  51. libexec) satcmd --saturnin-get-libexec | ckfuzzy ;;
  52. libexec_prefix) satcmd --saturnin-get-libexec-prefix | ckfuzzy ;;
  53. esac
  54. }
  55. tf_do_subtests