run-tests.sh 2.0 KB

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