Mercurial > hg > sonic-visualiser
comparison export-tests/test-scripted-generation.sh @ 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 | |
children |
comparison
equal
deleted
inserted
replaced
2573:e55433e351cd | 2574:0cbdd15a96f4 |
---|---|
1 #!/bin/bash | |
2 | |
3 set -e | |
4 | |
5 if [ -n "$1" ]; then | |
6 echo "Usage: $0" 1>&2 | |
7 exit 2 | |
8 fi | |
9 | |
10 set -u | |
11 | |
12 sv="../sonic-visualiser" | |
13 if [ ! -f "$sv" -o ! -x "$sv" ]; then | |
14 echo "This script must be run from the sonic-visualiser/test directory" 1>&2 | |
15 exit 1 | |
16 fi | |
17 | |
18 version=$("$sv" -v 2>&1 | grep -v App) | |
19 adequate=no | |
20 case "$version" in | |
21 [0123].*) ;; | |
22 4.0*) ;; | |
23 [1-9]*) adequate=yes ;; | |
24 *) echo "Failed to query Sonic Visualiser version" 1>&2 | |
25 exit 1 ;; | |
26 esac | |
27 if [ "$adequate" = "no" ]; then | |
28 echo "Sonic Visualiser version must be at least 4.1 (supporting --osc-script option with standard input)" 1>&2 | |
29 exit 1 | |
30 fi | |
31 | |
32 tmpdir=$(mktemp -d) | |
33 trap "rm -rf $tmpdir" 0 | |
34 | |
35 for method in 1 2; do | |
36 | |
37 echo "Testing method $method..." | |
38 | |
39 actual="$tmpdir/3dplot.csv" | |
40 expected="layers-expected/3dplot.csv" | |
41 | |
42 rm -f "$actual" | |
43 | |
44 if [ "$method" = "1" ]; then | |
45 ( echo "/open s1.wav" ; | |
46 echo "/transform vamp:qm-vamp-plugins:qm-keydetector:keystrength" ; | |
47 echo "/exportlayer $actual" ; | |
48 echo "/quit" ) | | |
49 ../sonic-visualiser --osc-script - | |
50 else | |
51 ( echo "/transform vamp:qm-vamp-plugins:qm-keydetector:keystrength" ; | |
52 echo "/exportlayer $actual" ; | |
53 echo "/quit" ) | | |
54 ../sonic-visualiser --osc-script - s1.wav | |
55 fi | |
56 | |
57 if ! cmp -s "$actual" "$expected" ; then | |
58 echo | |
59 echo "Test failed for method $method" | |
60 echo | |
61 echo "Actual:" | |
62 ls -l "$actual" | |
63 echo "Expected:" | |
64 ls -l "$expected" | |
65 echo | |
66 echo "Diff begins:" | |
67 git diff --no-index --word-diff=color --word-diff-regex=. "$actual" "$expected" | head | |
68 echo | |
69 fi | |
70 done |