run-tests 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. set -e
  3. DIR=$(readlink -f $(dirname $0))
  4. echo "Compiling the tests …"
  5. (cd $DIR && make)
  6. echo "Running all testcases …"
  7. LDPATH="$DIR/../../build/bin"
  8. EXT="_libapt_test"
  9. for testapp in $(ls ${LDPATH}/*$EXT)
  10. do
  11. name=$(basename ${testapp})
  12. tmppath=""
  13. if [ $name = "GetListOfFilesInDir${EXT}" ]; then
  14. # TODO: very-low: move env creation to the actual test-app
  15. echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
  16. tmppath=$(mktemp -d)
  17. touch "${tmppath}/anormalfile" \
  18. "${tmppath}/01yet-anothernormalfile" \
  19. "${tmppath}/anormalapt.conf" \
  20. "${tmppath}/01yet-anotherapt.conf" \
  21. "${tmppath}/anormalapt.list" \
  22. "${tmppath}/01yet-anotherapt.list" \
  23. "${tmppath}/wrongextension.wron" \
  24. "${tmppath}/wrong-extension.wron" \
  25. "${tmppath}/strangefile." \
  26. "${tmppath}/s.t.r.a.n.g.e.f.i.l.e" \
  27. "${tmppath}/.hiddenfile" \
  28. "${tmppath}/.hiddenfile.conf" \
  29. "${tmppath}/.hiddenfile.list" \
  30. "${tmppath}/multi..dot" \
  31. "${tmppath}/multi.dot.conf" \
  32. "${tmppath}/multi.dot.list" \
  33. "${tmppath}/disabledfile.disabled" \
  34. "${tmppath}/disabledfile.conf.disabled" \
  35. "${tmppath}/disabledfile.list.disabled" \
  36. "${tmppath}/invälid.conf" \
  37. "${tmppath}/invalíd" \
  38. "${tmppath}/01invalíd"
  39. mkdir "${tmppath}/invaliddir" \
  40. "${tmppath}/directory.conf" \
  41. "${tmppath}/directory.list" \
  42. "${tmppath}/directory.wron" \
  43. "${tmppath}/directory.list.disabled"
  44. ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
  45. ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
  46. elif [ $name = "getLanguages${EXT}" ]; then
  47. echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
  48. tmppath=$(mktemp -d)
  49. touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
  50. "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
  51. "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
  52. "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
  53. elif [ $name = "CompareVersion${EXT}" ]; then
  54. tmppath="${DIR}/versions.lst"
  55. fi
  56. echo -n "Testing with \033[1;35m${name}\033[0m ... "
  57. LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
  58. if [ -n "$tmppath" -a -d "$tmppath" ]; then
  59. echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
  60. rm -rf "$tmppath"
  61. fi
  62. done