tests_defaultcfg.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. echo -e ""
  3. echo -e "0.1 - Full comparison Output"
  4. echo -e "=================================================================="
  5. echo -e "Description:"
  6. echo -e "test checks that vars present in ALL _default.cfg files are correct."
  7. echo -e ""
  8. echo -e "In master config < | > In game config"
  9. find "lgsm/config-default/config-lgsm/" ! -name '*template.cfg' -name "*.cfg" -type f -print0 \
  10. | while IFS= read -r -d $'\0' line; do
  11. grep "=" "${line}" | cut -f1 -d"=" > defaultcfgtemp.txt
  12. diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_0.txt defaultcfgtemp.txt)
  13. if [ "${diffoutput}" ]; then
  14. echo "File with errors:"
  15. echo "${line}"
  16. echo -e "================================="
  17. echo -e "In master config < | > In game config"
  18. echo "${diffoutput}"
  19. echo ""
  20. fi
  21. rm -f defaultcfgtemp.txt
  22. done
  23. echo -e ""
  24. echo -e "1.0 - Master Comparison"
  25. echo -e "=================================================================="
  26. echo -e "Description:"
  27. echo -e "test checks that vars present in ALL _default.cfg files are correct."
  28. echo -e ""
  29. echo -e "In master config < | > In game config"
  30. find lgsm/config-default/config-lgsm/ ! -name '*template.cfg' -name "*.cfg" -type f -print0 \
  31. | while IFS= read -r -d $'\0' line; do
  32. grep "=" "${line}" | cut -f1 -d"=" > defaultcfgtemp.txt
  33. diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_0.txt defaultcfgtemp.txt | grep '^<')
  34. if [ "${diffoutput}" ]; then
  35. echo "File with errors:"
  36. echo "${line}"
  37. echo -e "================================="
  38. echo -e "In master config < | > In game config"
  39. echo "${diffoutput}"
  40. echo ""
  41. fi
  42. rm -f defaultcfgtemp.txt
  43. done
  44. echo -e ""
  45. echo -e "2.0 - Check Comment"
  46. echo -e "=================================================================="
  47. echo -e "Description:"
  48. echo -e "test checks that comments in ALL _default.cfg files are correct."
  49. echo -e ""
  50. echo -e "In master config < | > In game config"
  51. find lgsm/config-default/config-lgsm/ ! -name '*template.cfg' -name "*.cfg" -type f -print0 \
  52. | while IFS= read -r -d $'\0' line; do
  53. grep "#" "${line}" > defaultcfgtemp.txt
  54. diffoutput=$(diff tests/tests_defaultcfg/defaultcfg_1.txt defaultcfgtemp.txt | grep '^<')
  55. if [ "${diffoutput}" ]; then
  56. echo "File with errors:"
  57. echo "${line}"
  58. echo -e "================================="
  59. echo "${diffoutput}"
  60. echo ""
  61. fi
  62. rm -f defaultcfgtemp.txt
  63. done