run-tests.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. fi
  41. echo -n "Testing with \033[1;35m${name}\033[0m ... "
  42. LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
  43. if [ -n "$tmppath" -a -d "$tmppath" ]; then
  44. echo "Cleanup Testarea after \033[1;35m$name\033[0m ..."
  45. rm -rf "$tmppath"
  46. fi
  47. done