2
0

run.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. set -eux
  3. bail() {
  4. echo >&2 "@"
  5. exit 1
  6. }
  7. header() {
  8. echo '################################################################################'
  9. echo "# $*"
  10. echo '################################################################################'
  11. }
  12. run_tests() {
  13. flavor="$1"
  14. shift
  15. header "Cleaning up leftovers from previous runs"
  16. for name in tinc tincd; do
  17. sudo pkill -TERM -x "$name" || true
  18. sudo pkill -KILL -x "$name" || true
  19. done
  20. sudo chown -R "${USER:-$(whoami)}" . || true
  21. mkdir -p sanitizer /tmp/logs
  22. header "Running test flavor $flavor"
  23. ./.ci/build.sh "$flavor" "$@"
  24. if [ "${HOST:-}" = mingw ]; then
  25. echo >&2 "Integration tests cannot run under wine, skipping"
  26. return 0
  27. fi
  28. if [ -n "${HOST:-}" ]; then
  29. echo >&2 "Using higher test timeout for cross-compilation job $HOST"
  30. timeout=10
  31. else
  32. timeout=1
  33. fi
  34. code=0
  35. meson test -C "$flavor" --timeout-multiplier $timeout --verbose || code=$?
  36. sudo tar -c -z -f "/tmp/logs/tests.$flavor.tar.gz" "$flavor" sanitizer/ || true
  37. return $code
  38. }
  39. case "$(uname -s)" in
  40. MINGW* | Darwin) sudo() { "$@"; } ;;
  41. esac
  42. flavor=$1
  43. shift
  44. case "$flavor" in
  45. default)
  46. run_tests default "$@"
  47. ;;
  48. nolegacy)
  49. run_tests nolegacy -Dcrypto=nolegacy "$@"
  50. ;;
  51. gcrypt)
  52. run_tests gcrypt -Dcrypto=gcrypt "$@"
  53. ;;
  54. openssl3)
  55. if [ -d /opt/ssl3 ]; then
  56. run_tests openssl3 -Dpkg_config_path=/opt/ssl3/lib64/pkgconfig "$@"
  57. else
  58. echo >&2 "OpenSSL 3 not installed, skipping test"
  59. fi
  60. ;;
  61. *)
  62. bail "unknown test flavor $1"
  63. ;;
  64. esac