4
0

check-plugins.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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, each VST3 and each LV2 (Linux, round 190ov): 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. # lv2lint each LV2, when $LV2LINT names it (round 190pk; LV2_PATH must hold the LV2 specification bundles)
  8. # Every report goes to <reports dir>; with [pictures], plugexporttest also draws each editor there (PNG).
  9. # Exit 0 = everything passed. A failed tool doesn't stop the others: the summary lists every result.
  10. #
  11. # scripts/check-plugins.sh <package dir> <plugexporttest> <pluginval> <clap-validator> <reports dir> [pictures]
  12. set -uo pipefail
  13. pkg="$1" tester="$2" pluginval="$3" validator="$4" reports="$5" pictures="${6:-}"
  14. mkdir -p "$reports"
  15. export LYNX_PROFILE_DIR="${LYNX_PROFILE_DIR:-$reports/profile}"
  16. export LYNX_TEST_MODE=1
  17. # (Windows tools want Windows paths)
  18. native() {
  19. local p
  20. p="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
  21. if command -v cygpath > /dev/null; then cygpath -w "$p"; else echo "$p"; fi
  22. }
  23. results=()
  24. run() { # <label> <log> <command...>
  25. local label="$1" log="$2" rc
  26. shift 2
  27. echo "::group::$label"
  28. "$@" > "$log" 2>&1
  29. rc=$?
  30. tail -n 40 "$log"
  31. echo "::endgroup::"
  32. results+=("$([[ $rc == 0 ]] && echo PASS || echo "FAIL ($rc)") $label")
  33. }
  34. clap=("$pkg"/CLAP/*.clap)
  35. vst3=()
  36. for b in "$pkg"/VST3/*.vst3; do [[ -e "$b" ]] && vst3+=("$b"); done
  37. lv2=()
  38. for b in "$pkg"/LV2/*.lv2; do [[ -e "$b" ]] && lv2+=("$b"); done
  39. [[ -e "${clap[0]}" ]] || { echo "no CLAP in $pkg/CLAP" >&2; exit 1; }
  40. # (${a[@]+"${a[@]}"}: macOS' bash 3.2 calls an empty array unbound under set -u)
  41. for p in "${clap[@]}" ${vst3[@]+"${vst3[@]}"} ${lv2[@]+"${lv2[@]}"}; do
  42. name="$(basename "$p")"
  43. extra=()
  44. [[ -n "$pictures" && "$p" == *.clap ]] && extra=("$(native "$reports")/editor-")
  45. run "plugexporttest $name" "$reports/plugexporttest-$name.log" "$tester" "$(native "$p")" "$(native "$reports")/plugexporttest-$name.txt" ${extra[@]+"${extra[@]}"}
  46. done
  47. for p in ${vst3[@]+"${vst3[@]}"}; do
  48. name="$(basename "$p")"
  49. run "pluginval $name" "$reports/pluginval-$name.log" "$pluginval" --validate "$(native "$p")" --strictness-level 10 --skip-gui-tests \
  50. --validate-in-process --timeout-ms 300000
  51. done
  52. for p in "${clap[@]}"; do
  53. run "clap-validator $(basename "$p")" "$reports/clap-validator.log" "$validator" validate --in-process "$(native "$p")"
  54. done
  55. # (two of lv2lint's checks are skipped, both about JUCE's LV2 wrapper, not LYNX: "Plugin Run" fails any run() that takes a
  56. # mutex, and JUCE's run() takes the processor's callback lock, uncontended unless the host is loading a state, as its VST3
  57. # wrapper does; "UI Resize Interface" fails the ui:resize extension data JUCE's editor offers for hosts that resize it)
  58. if [[ -n "${LV2LINT:-}" ]]; then
  59. for p in ${lv2[@]+"${lv2[@]}"}; do
  60. name="$(basename "$p")"
  61. uri="$(sed -n 's/^<\([^>]*\)>$/\1/p' "$p/manifest.ttl" | head -n 1)"
  62. run "lv2lint $name" "$reports/lv2lint-$name.log" "$LV2LINT" -Mpack -t 'Plugin Run' -t 'UI Resize Interface' -I "$p/" "$uri"
  63. done
  64. fi
  65. echo
  66. echo "LYNX plugin checks ($pkg):"
  67. fail=0
  68. for r in ${results[@]+"${results[@]}"}; do
  69. echo " $r"
  70. [[ "$r" == PASS* ]] || fail=1
  71. done
  72. printf '%s\n' ${results[@]+"${results[@]}"} > "$reports/summary.txt"
  73. exit $fail