Chris@2438: #!/bin/bash Chris@2438: # Chris@2438: # Regression tests for layer export to CSV Chris@2438: # Must be run from directory that contains this script Chris@2438: Chris@2438: # NB hardcoded assumptions here about the contents of the session Chris@2438: # file, so the session file (all.sv) is also hardcoded. The session is Chris@2438: # expected to consist of: Chris@2438: # Chris@2438: # - pane 1 with 3 layers (ruler, waveform, instants) Chris@2438: # - pane 2 with 3 layers (ruler, waveform, values) Chris@2438: # - pane 3 with 3 layers (ruler, image, regions) Chris@2438: # - pane 4 with 3 layers (ruler, text, notes) Chris@2438: # - pane 5 with 2 layers (ruler, 3d plot) Chris@2438: # - pane 6 with 3 layers (ruler, spectrogram, boxes) Chris@2438: # - pane 7 with 2 layers (ruler, peak frequency spectrogram) Chris@2438: Chris@2438: set -e Chris@2438: Chris@2438: if [ -n "$1" ]; then Chris@2438: echo "Usage: $0" 1>&2 Chris@2438: exit 2 Chris@2438: fi Chris@2438: Chris@2438: set -u Chris@2438: Chris@2438: sv="../sonic-visualiser" Chris@2438: if [ ! -f "$sv" -o ! -x "$sv" ]; then Chris@2438: echo "This script must be run from the sonic-visualiser/test directory" 1>&2 Chris@2438: exit 1 Chris@2438: fi Chris@2438: Chris@2438: version=$("$sv" -v 2>&1) Chris@2438: adequate=no Chris@2438: case "$version" in Chris@2438: [012].*) ;; Chris@2438: 3.[012]) ;; Chris@2438: 3.[012].*) ;; Chris@2438: [1-9]*) adequate=yes ;; Chris@2438: *) echo "Failed to query Sonic Visualiser version" 1>&2 Chris@2438: exit 1 ;; Chris@2438: esac Chris@2438: if [ "$adequate" = "no" ]; then Chris@2438: echo "Sonic Visualiser version must be at least 3.3 (supporting --osc-script option)" 1>&2 Chris@2438: exit 1 Chris@2438: fi Chris@2438: Chris@2438: session="all.sv" Chris@2438: Chris@2438: if [ ! -f "$session" ]; then Chris@2438: echo "Session file $session not found" 1>&2 Chris@2438: exit 1 Chris@2438: fi Chris@2438: Chris@2438: tmpdir=$(mktemp -d) Chris@2443: trap "rm -rf $tmpdir" 0 Chris@2438: Chris@2438: input="$tmpdir/input.sv" Chris@2438: Chris@2438: cp "$session" "$input" Chris@2438: Chris@2438: cat > "$tmpdir/script" < "$actual".txt Chris@2439: od -c "$expected" > "$tmpdir/expected-$other".txt Chris@2439: echo Chris@2439: echo "Diff:" Chris@2439: diff -u1 "$actual".txt "$tmpdir/expected-$other".txt Chris@2438: echo Chris@2438: fi Chris@2438: done Chris@2438: