Mercurial > hg > sonic-visualiser
changeset 2245:4b83a942ca29 single-point
Test files
author | Chris Cannam |
---|---|
date | Fri, 29 Mar 2019 11:24:46 +0000 |
parents | 5fcb120d1566 |
children | 4ec0337c2c9f |
files | misc/test-session-export.sh test/s1.ogg test/s2.ogg test/test-session-export.sh |
diffstat | 4 files changed, 75 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/misc/test-session-export.sh Thu Mar 28 16:04:29 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -#!/bin/bash -# -# Test that loading and re-saving a session does not change its contents -# Must be run from same directory as the SV binary - -set -e - -session="$1" - -set -u - -sv="./sonic-visualiser" -if [ ! -x "$sv" ]; then - echo "This script must be run from the directory containing the sonic-visualiser binary" 1>&2 - exit 1 -fi - -if ! xmllint --version 2>/dev/null ; then - echo "Can't find required xmllint program (from libxml2 distribution)" 1>&2 - exit 1 -fi - -version=$("$sv" -v 2>&1) -adequate=no -case "$version" in - [012].*) ;; - 3.[012]) ;; - 3.[012].*) ;; - [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 3.3 (supporting --osc-script option)" 1>&2 - exit 1 -fi - -if [ -z "$session" ]; then - echo "Usage: $0 <session.sv>" 1>&2 - exit 2 -fi - -if [ ! -f "$session" ]; then - echo "Session file $session not found" 1>&2 - exit 1 -fi - -tmpdir=$(mktemp -d) -trap "rm -rf $tmpdir" 0 - -input="$tmpdir/input.sv" -inxml="$tmpdir/input.xml" -output="$tmpdir/output.sv" -outxml="$tmpdir/output.xml" - -cp "$session" "$input" - -cat > "$tmpdir/script" <<EOF -/open "$input" -/save "$output" -/quit -EOF - -"$sv" --no-splash --osc-script "$tmpdir/script" - -if [ ! -f "$output" ]; then - echo "ERROR: Failed to save session to $output at all!" 1>&2 - exit 1 -fi - -bunzip2 -c "$input" | xmllint --format - > "$inxml" -bunzip2 -c "$output" | xmllint --format - > "$outxml" - -sdiff -w 140 "$inxml" "$outxml" -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/test-session-export.sh Fri Mar 29 11:24:46 2019 +0000 @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Test that loading and re-saving a session does not change its contents +# Must be run from same directory as the SV binary + +set -e + +session="$1" + +set -u + +sv="./sonic-visualiser" +if [ ! -x "$sv" ]; then + echo "This script must be run from the directory containing the sonic-visualiser binary" 1>&2 + exit 1 +fi + +if ! xmllint --version 2>/dev/null ; then + echo "Can't find required xmllint program (from libxml2 distribution)" 1>&2 + exit 1 +fi + +version=$("$sv" -v 2>&1) +adequate=no +case "$version" in + [012].*) ;; + 3.[012]) ;; + 3.[012].*) ;; + [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 3.3 (supporting --osc-script option)" 1>&2 + exit 1 +fi + +if [ -z "$session" ]; then + echo "Usage: $0 <session.sv>" 1>&2 + exit 2 +fi + +if [ ! -f "$session" ]; then + echo "Session file $session not found" 1>&2 + exit 1 +fi + +tmpdir=$(mktemp -d) +trap "rm -rf $tmpdir" 0 + +input="$tmpdir/input.sv" +inxml="$tmpdir/input.xml" +output="$tmpdir/output.sv" +outxml="$tmpdir/output.xml" + +cp "$session" "$input" + +cat > "$tmpdir/script" <<EOF +/open "$input" +/save "$output" +/quit +EOF + +"$sv" --no-splash --osc-script "$tmpdir/script" + +if [ ! -f "$output" ]; then + echo "ERROR: Failed to save session to $output at all!" 1>&2 + exit 1 +fi + +bunzip2 -c "$input" | xmllint --format - > "$inxml" +bunzip2 -c "$output" | xmllint --format - > "$outxml" + +sdiff -w 140 "$inxml" "$outxml" +