check-plugins.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env bash
  2. # Checks an unpacked LYNX plugin download (scripts/package-plugins.sh) the way hosts will load it (round 188b,
  3. # docs/PLUGIN_EXPORT.md), on Windows (Git Bash), Linux or macOS:
  4. # plugexporttest the CLAP and each VST3: scan, null test against the engine, automation, state, editor, memory, CPU
  5. # pluginval each VST3, strictness 10, no GUI tests (no screen on CI)
  6. # clap-validator the CLAP
  7. # Every report goes to <reports dir>; with [pictures], plugexporttest also draws each editor there (PNG).
  8. # Exit 0 = everything passed. A failed tool doesn't stop the others: the summary lists every result.
  9. #
  10. # scripts/check-plugins.sh <package dir> <plugexporttest> <pluginval> <clap-validator> <reports dir> [pictures]
  11. set -uo pipefail
  12. pkg="$1" tester="$2" pluginval="$3" validator="$4" reports="$5" pictures="${6:-}"
  13. mkdir -p "$reports"
  14. export LYNX_PROFILE_DIR="${LYNX_PROFILE_DIR:-$reports/profile}"
  15. export LYNX_TEST_MODE=1
  16. # (Windows tools want Windows paths)
  17. native() {
  18. local p
  19. p="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
  20. if command -v cygpath > /dev/null; then cygpath -w "$p"; else echo "$p"; fi
  21. }
  22. results=()
  23. run() { # <label> <log> <command...>
  24. local label="$1" log="$2" rc
  25. shift 2
  26. echo "::group::$label"
  27. "$@" > "$log" 2>&1
  28. rc=$?
  29. tail -n 40 "$log"
  30. echo "::endgroup::"
  31. results+=("$([[ $rc == 0 ]] && echo PASS || echo "FAIL ($rc)") $label")
  32. }
  33. clap=("$pkg"/CLAP/*.clap)
  34. vst3=()
  35. for b in "$pkg"/VST3/*.vst3; do [[ -e "$b" ]] && vst3+=("$b"); done
  36. [[ -e "${clap[0]}" ]] || { echo "no CLAP in $pkg/CLAP" >&2; exit 1; }
  37. # (${a[@]+"${a[@]}"}: macOS' bash 3.2 calls an empty array unbound under set -u)
  38. for p in "${clap[@]}" ${vst3[@]+"${vst3[@]}"}; do
  39. name="$(basename "$p")"
  40. extra=()
  41. [[ -n "$pictures" && "$p" == *.clap ]] && extra=("$(native "$reports")/editor-")
  42. run "plugexporttest $name" "$reports/plugexporttest-$name.log" "$tester" "$(native "$p")" "$(native "$reports")/plugexporttest-$name.txt" ${extra[@]+"${extra[@]}"}
  43. done
  44. for p in ${vst3[@]+"${vst3[@]}"}; do
  45. name="$(basename "$p")"
  46. run "pluginval $name" "$reports/pluginval-$name.log" "$pluginval" --validate "$(native "$p")" --strictness-level 10 --skip-gui-tests \
  47. --validate-in-process --timeout-ms 300000
  48. done
  49. for p in "${clap[@]}"; do
  50. run "clap-validator $(basename "$p")" "$reports/clap-validator.log" "$validator" validate --in-process "$(native "$p")"
  51. done
  52. echo
  53. echo "LYNX plugin checks ($pkg):"
  54. fail=0
  55. for r in ${results[@]+"${results[@]}"}; do
  56. echo " $r"
  57. [[ "$r" == PASS* ]] || fail=1
  58. done
  59. printf '%s\n' ${results[@]+"${results[@]}"} > "$reports/summary.txt"
  60. exit $fail