1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
#!/bin/bash
# Linux
MSCORE=../../build/mscore/mscore
# OS X terminal build
#MSCORE=../applebuild/mscore.app/Contents/MacOS/mscore
# OS X Xcode build
#MSCORE=../build.xcode/mscore/Debug/mscore.app/Contents/MacOS/mscore
echo "------------------------------"
echo "Regression Tests for MuseScore"
echo "------------------------------"
echo
$MSCORE -v
echo
testcount=0
failures=0
rwtest() {
echo -n "testing load/save $1";
$MSCORE $1 -o mops.mscx &> /dev/null
if diff -q $1 mops.mscx &> /dev/null; then
echo -e "\r\t\t\t\t\t\t...OK";
else
echo -e "\r\t\t\t\t\t\t...FAILED";
failures=$(($failures+1));
echo "+++++++++DIFF++++++++++++++"
diff $1 mops.mscx
echo "+++++++++++++++++++++++++++"
fi
rm mops.mscx
testcount=$(($testcount+1))
}
rwtestBww() {
echo -n "testing load/save $1";
REF=bwwrefs/`basename $1 .bww`.xml
$MSCORE ../bww2mxml/test/$1 -d -o mops.xml &> /dev/null
if diff -q $REF mops.xml &> /dev/null; then
echo -e "\r\t\t\t\t\t\t...OK";
else
echo -e "\r\t\t\t\t\t\t...FAILED";
failures=$(($failures+1));
echo "+++++++++DIFF++++++++++++++"
diff $REF mops.xml
echo "+++++++++++++++++++++++++++"
fi
rm mops.xml
testcount=$(($testcount+1))
}
rwtestXml() {
echo -n "testing load/save $1";
$MSCORE $1 -d -o mops.xml &> /dev/null
if diff -q $1 mops.xml &> /dev/null; then
echo -e "\r\t\t\t\t\t\t...OK";
else
echo -e "\r\t\t\t\t\t\t...FAILED";
failures=$(($failures+1));
echo "+++++++++DIFF++++++++++++++"
diff $1 mops.xml
echo "+++++++++++++++++++++++++++"
fi
rm mops.xml
testcount=$(($testcount+1))
}
rwtestXmlRef() {
echo -n "testing load/save $1";
REF=musicxml/`basename $1 .xml`_ref.xml
$MSCORE $1 -d -o mops.xml &> /dev/null
if diff -q $REF mops.xml &> /dev/null; then
echo -e "\r\t\t\t\t\t\t...OK";
else
echo -e "\r\t\t\t\t\t\t...FAILED";
failures=$(($failures+1));
echo "+++++++++DIFF++++++++++++++"
diff $REF mops.xml
echo "+++++++++++++++++++++++++++"
fi
rm mops.xml
testcount=$(($testcount+1))
}
rwtestAllBww() {
rwtestBww testBeams.bww
rwtestBww testDoublings.bww
rwtestBww testDuration.bww
rwtestBww testGraces.bww
rwtestBww testHello.bww
rwtestBww testMidMeasureRepeat.bww
rwtestBww testNotes.bww
rwtestBww testNoTimeSig1.bww
rwtestBww testNoTimeSig2.bww
rwtestBww testRepeats.bww
rwtestBww testTempo60.bww
rwtestBww testTempo120.bww
rwtestBww testTieTriplet.bww
rwtestBww testTriplets.bww
}
rwtestAllDemos() {
rwtest ../demos/promenade.mscx
rwtest ../demos/adeste.mscx
rwtest ../demos/inv10.mscx
rwtest ../demos/inv13.mscx
rwtest ../demos/inv1.mscx
rwtest ../demos/inv6.mscx
rwtest ../demos/praeludium1.mscx
rwtest ../demos/prelude.mscx
rwtest ../demos/scales.mscx
rwtest ../demos/sonata16.mscx
rwtest ../demos/bach-bc2.mscx
}
rwtestAllMsc() {
rwtest msc/accidental1.msc
rwtest msc/accidental2.msc
rwtest msc/chromatic.msc
rwtest msc/coda.msc
rwtest msc/crossbeams.msc
rwtest msc/RepeatTest6.msc
rwtest msc/RepeatTest7.msc
rwtest msc/scales1.msc
rwtest msc/slur2.msc
rwtest msc/test1.msc
rwtest msc/test2.msc
rwtest msc/test7.msc
rwtest msc/testKeysig2.msc
rwtest msc/testsmall.msc
rwtest msc/testTimesig2.msc
rwtest msc/tuplets.msc
}
rwtestAllXml() {
# The set of MusicXML files to test are available in files testfiles_MusicXML_regular
# (these should be unchanged after a roundtrip through MuseScore) and
# testfiles_MusicXML_with_ref (expected to be changed, to be tested against
# a reference file).
# This also enable easy regeneration of testfiles in case MuseScores output changes.
for f in `cat musicxml/testfiles_MusicXML_regular musicxml/testfiles_MusicXML_with_ref | sort`; do
if [ -f musicxml/`basename $f .xml`_ref.xml ]; then
# reference file exists, test against it
rwtestXmlRef musicxml/$f
else
# reference file does not exist: use regular test
rwtestXml musicxml/$f
fi
done
}
usage() {
echo "usage: $0 [bww | demos | msc | xml]"
echo "or: $0 [bww | msc | xml] <file>"
echo
exit 1
}
if [ $# -eq 0 ]; then
rwtestAllBww
rwtestAllDemos
rwtestAllMsc
rwtestAllXml
elif [ $# -eq 1 ]; then
if [ "$1" == "bww" ]; then
rwtestAllBww
elif [ "$1" == "demos" ]; then
rwtestAllDemos
elif [ "$1" == "msc" ]; then
rwtestAllMsc
elif [ "$1" == "xml" ]; then
rwtestAllXml
else
usage
fi
elif [ $# -eq 2 ]; then
if [ "$1" == "bww" ]; then
rwtest $2
elif [ "$1" == "msc" ]; then
rwtest $2
elif [ "$1" == "xml" ]; then
rwtestXml $2
else
usage
fi
elif [ $# -ge 3 ]; then
usage
fi
echo
echo "$testcount test(s), $failures failure(s)"
|