| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # simple standalone iotest for MusicXML import |
| 4 | # run in mtest/musicxml/io directory as "./iotest" |
| 5 | |
| 6 | # Linux |
| 7 | #MSCORE=../../../build.debug/mscore/mscore |
| 8 | # OS X terminal build |
| 9 | #MSCORE=../../../applebuild/mscore.app/Contents/MacOS/mscore |
| 10 | # OS X Xcode build |
| 11 | MSCORE=../../../build.xcode/mscore/Debug/mscore.app/Contents/MacOS/mscore |
| 12 | |
| 13 | echoscip-shell system . . echo. "----------------------------------------------" |
| 14 | echoscip-shell system . . echo. "Regression Tests for MuseScore MusicXML import" |
| 15 | echoscip-shell system . . echo. "----------------------------------------------" |
| 16 | echoscip-shell system . . echo. |
| 17 | $MSCORE -v |
| 18 | echoscip-shell system . . echo. |
| 19 | |
| 20 | |
| 21 | musicxml_files=`catscip-shell system . . cat. tst_mxml_io.cpp | grepscip-shell system . . grep. "{ mxmlIoTest" | awkscip-shell system . . awk. -F\" '{print $2}' | sortscip-shell system . . sort.` |
| 22 | testcount=0 |
| 23 | failures=0 |
| 24 | |
| 25 | rwtestXmlscip-shell shell shell-project 0.0.0 rwtestXml().() { |
| 26 | echoscip-shell system . . echo. -n "testing load/save $1"; |
| 27 | $MSCORE $1 -d -o mops.xml &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 28 | if diffscip-shell system . . diff. -q $1 mops.xml &> /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 29 | echoscip-shell system . . echo. -e "\r\t\t\t\t\t\t...OK"; |
| 30 | else |
| 31 | echoscip-shell system . . echo. -e "\r\t\t\t\t\t\t...FAILED"; |
| 32 | failures=$(($failures+1)); |
| 33 | echoscip-shell system . . echo. "+++++++++DIFF++++++++++++++" |
| 34 | diffscip-shell system . . diff. $1 mops.xml |
| 35 | echoscip-shell system . . echo. "+++++++++++++++++++++++++++" |
| 36 | fi |
| 37 | rmscip-shell system . . rm. mops.xml |
| 38 | testcount=$(($testcount+1)) |
| 39 | } |
| 40 | |
| 41 | rwtestXmlRefscip-shell shell shell-project 0.0.0 rwtestXmlRef().() { |
| 42 | echoscip-shell system . . echo. -n "testing load/save $1"; |
| 43 | REF=`basenamescip-shell system . . basename. $1 .xml`_ref.xml |
| 44 | $MSCORE $1 -d -o mops.xml &> /dev/nullscip-shell filesystem . . `/dev/null`. |
| 45 | if diffscip-shell system . . diff. -q $REF mops.xml &> /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 46 | echoscip-shell system . . echo. -e "\r\t\t\t\t\t\t...OK"; |
| 47 | else |
| 48 | echoscip-shell system . . echo. -e "\r\t\t\t\t\t\t...FAILED"; |
| 49 | failures=$(($failures+1)); |
| 50 | echoscip-shell system . . echo. "+++++++++DIFF++++++++++++++" |
| 51 | diffscip-shell system . . diff. $REF mops.xml |
| 52 | echoscip-shell system . . echo. "+++++++++++++++++++++++++++" |
| 53 | fi |
| 54 | rmscip-shell system . . rm. mops.xml |
| 55 | testcount=$(($testcount+1)) |
| 56 | } |
| 57 | |
| 58 | rwtestAllXmlscip-shell shell shell-project 0.0.0 rwtestAllXml().() { |
| 59 | for f in $musicxml_files; do |
| 60 | if [scip-shell system . . `[`. -f ${f}_ref.xml ]; then |
| 61 | # reference file exists, test against it |
| 62 | rwtestXmlRefscip-shell shell shell-project 0.0.0 rwtestXmlRef(). ${f}.xml |
| 63 | else |
| 64 | # reference file does not exist: use regular test |
| 65 | rwtestXmlscip-shell shell shell-project 0.0.0 rwtestXml(). ${f}.xml |
| 66 | fi |
| 67 | done |
| 68 | } |
| 69 | |
| 70 | usagescip-shell shell shell-project 0.0.0 usage().() { |
| 71 | echoscip-shell system . . echo. "usage: $0" |
| 72 | echoscip-shell system . . echo. |
| 73 | exit 1 |
| 74 | } |
| 75 | |
| 76 | if [scip-shell system . . `[`. $# -eq 0 ]; then |
| 77 | rwtestAllXmlscip-shell shell shell-project 0.0.0 rwtestAllXml(). |
| 78 | else |
| 79 | usagescip-shell shell shell-project 0.0.0 usage(). |
| 80 | fi |
| 81 | |
| 82 | echoscip-shell system . . echo. |
| 83 | echoscip-shell system . . echo. "$testcount test(s), $failures failure(s)" |