changeset 2574:0cbdd15a96f4

Ensure transforms are populated before trying to instantiate a plugin for one; add (export-style) test for this
author Chris Cannam
date Thu, 25 Jun 2020 13:32:23 +0100
parents e55433e351cd
children 32c3e8dfd11d
files export-tests/test-scripted-generation.sh repoint-lock.json
diffstat 2 files changed, 71 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/export-tests/test-scripted-generation.sh	Thu Jun 25 13:32:23 2020 +0100
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+set -e
+
+if [ -n "$1" ]; then
+    echo "Usage: $0" 1>&2
+    exit 2
+fi
+
+set -u
+
+sv="../sonic-visualiser"
+if [ ! -f "$sv" -o ! -x "$sv" ]; then
+    echo "This script must be run from the sonic-visualiser/test directory" 1>&2
+    exit 1
+fi
+
+version=$("$sv" -v 2>&1 | grep -v App)
+adequate=no
+case "$version" in
+    [0123].*) ;;
+    4.0*) ;;
+    [1-9]*) adequate=yes ;;
+    *) echo "Failed to query Sonic Visualiser version" 1>&2
+       exit 1 ;;
+esac
+if [ "$adequate" = "no" ]; then
+    echo "Sonic Visualiser version must be at least 4.1 (supporting --osc-script option with standard input)" 1>&2
+    exit 1
+fi
+
+tmpdir=$(mktemp -d)
+trap "rm -rf $tmpdir" 0
+
+for method in 1 2; do
+
+    echo "Testing method $method..."
+
+    actual="$tmpdir/3dplot.csv"
+    expected="layers-expected/3dplot.csv"
+
+    rm -f "$actual"
+    
+    if [ "$method" = "1" ]; then
+        ( echo "/open s1.wav" ;
+          echo "/transform vamp:qm-vamp-plugins:qm-keydetector:keystrength" ;
+          echo "/exportlayer $actual" ;
+          echo "/quit" ) |
+            ../sonic-visualiser --osc-script -
+    else
+        ( echo "/transform vamp:qm-vamp-plugins:qm-keydetector:keystrength" ;
+          echo "/exportlayer $actual" ;
+          echo "/quit" ) |
+            ../sonic-visualiser --osc-script - s1.wav
+    fi
+
+    if ! cmp -s "$actual" "$expected" ; then
+        echo
+        echo "Test failed for method $method"
+        echo
+        echo "Actual:"
+        ls -l "$actual"
+        echo "Expected:"
+        ls -l "$expected"
+        echo
+        echo "Diff begins:"
+        git diff --no-index --word-diff=color --word-diff-regex=. "$actual" "$expected" | head
+        echo
+    fi
+done
--- a/repoint-lock.json	Mon Jun 22 17:08:17 2020 +0100
+++ b/repoint-lock.json	Thu Jun 25 13:32:23 2020 +0100
@@ -4,7 +4,7 @@
       "pin": "0e32c328b02a"
     },
     "svcore": {
-      "pin": "258e356b1a7b"
+      "pin": "5671836cdac7"
     },
     "svgui": {
       "pin": "fe9a643b83bf"