| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | faust --version || exit $? |
| 4 | echoscip-shell system . . echo. location $(command -v faust) |
| 5 | |
| 6 | # detect the current system |
| 7 | system=$(unamescip-shell system . . uname. -s) |
| 8 | |
| 9 | # normalizes MINGW versions |
| 10 | system=$(echoscip-shell system . . echo. $system | grepscip-shell system . . grep. MINGW > /dev/nullscip-shell filesystem . . `/dev/null`. && echoscip-shell system . . echo. MINGW || echoscip-shell system . . echo. $system) |
| 11 | |
| 12 | if echoscip-shell system . . echo. "${VERBOSE}" | grepscip-shell system . . grep. -iE "1|on|yes|true"; then |
| 13 | verbose=/dev/stdoutscip-shell filesystem . . `/dev/stdout`. |
| 14 | else |
| 15 | verbose=/dev/nullscip-shell filesystem . . `/dev/null`. |
| 16 | fi |
| 17 | |
| 18 | ## manual exclusion list |
| 19 | : ${TESTS_EXCLUDED:=} |
| 20 | |
| 21 | ## exclusion list for faust errors |
| 22 | : ${XLIST1:="faust2md"} |
| 23 | |
| 24 | if [scip-shell system . . `[`. "$system" = "Darwin" ]; then |
| 25 | : ${TESTS:=faust2cmajor faust2vcvrack faust2cagtk faust2android faust2au faust2caqt faust2csound faust2faustvst faust2jack faust2jaqt faust2w32max6 faust2w64max6 faust2max6 faust2msp faust2puredata faust2supercollider faust2unity faust2vst faust2vsti faust2w32vst faust2w64vst faust2ios faust2netjackconsole faust2netjackqt faust2jackconsole faust2lv2 faust2sndfile faust2csvplot faust2plot} |
| 26 | : ${TESTS_SOUND:=faust2cagtk faust2android faust2caqt faust2jaqt faust2jack faust2ios faust2max6 faust2msp faust2jackconsole faust2juce faust2bela} |
| 27 | : ${TESTS_SOUNDSR:=faust2cagtk faust2caqt faust2jaqt faust2jack} |
| 28 | : ${TESTS_MIDI:=faust2cmajor faust2cagtk faust2caqt faust2jack faust2jaqt faust2max6 faust2msp faust2ios faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 29 | : ${TESTS_POLY:=faust2unity faust2cmajor faust2vcvrack faust2cagtk faust2caqt faust2jack faust2jaqt faust2max6 faust2msp faust2ios faust2juce faust2netjackconsole faust2netjackqt faust2jackconsole faust2lv2} |
| 30 | : ${TESTS_POLYMIDI:=faust2cmajor faust2cagtk faust2caqt faust2jack faust2jaqt faust2max6 faust2msp faust2ios faust2juce faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 31 | : ${TESTS_POLY2MIDI:=faust2cmajor faust2cagtk faust2caqt faust2ios faust2max6 faust2msp faust2juce faust2netjackconsole faust2netjackqt} |
| 32 | : ${TESTS_HTTPD:=faust2cagtk faust2caqt faust2jack faust2jaqt faust2jackconsole faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 33 | : ${TESTS_OSC:=faust2cagtk faust2ios faust2caqt faust2jack faust2jaqt faust2jackconsole faust2netjackconsole faust2netjackqt faust2jackconsole faust2max6 faust2msp faust2android} |
| 34 | : ${TESTS_OSCHTTPD:=faust2cagtk faust2caqt faust2jack faust2jaqt faust2jackconsole faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 35 | : ${TESTS_PRESET_AUTO=faust2cagtk faust2caqt faust2jack faust2jaqt} |
| 36 | : ${TESTS_PRESET_DIR:=faust2cagtk faust2caqt faust2jack faust2jaqt} |
| 37 | elif [scip-shell system . . `[`. "$system" = "Linux" ]; then |
| 38 | : ${TESTS:=faust2alqt faust2alsa faust2alsaconsole faust2android faust2asmjs faust2bela faust2csound faust2dssi faust2eps faust2faustvst faust2firefox faust2graph faust2graphviewer faust2jack faust2jackinternal faust2jackserver faust2jaqt faust2ladspa faust2lv2 faust2mathdoc faust2md faust2netjackconsole faust2netjackqt faust2octave faust2owl faust2paqt faust2pdf faust2plot faust2png faust2puredata faust2raqt faust2ros faust2rosgtk faust2rpialsaconsole faust2rpinetjackconsole faust2sig faust2sigviewer faust2supercollider faust2svg faust2w32max6 faust2w32msp faust2w32puredata faust2w32vst faust2w64vst faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 39 | : ${TESTS_MIDI:=faust2jaqt faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 40 | : ${TESTS_POLY:=faust2jaqt faust2juce faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 41 | : ${TESTS_POLYMIDI:=faust2jaqt faust2juce faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 42 | : ${TESTS_OSCHTTPD:=faust2jaqt faust2netjackconsole faust2netjackqt faust2jackconsole} |
| 43 | elif [scip-shell system . . `[`. "$system" = "MINGW" ]; then |
| 44 | echoscip-shell system . . echo. "not yet implemented" |
| 45 | exit 1 |
| 46 | fi |
| 47 | |
| 48 | ## test exclusion : notinlist "toto" "a b c d e" |
| 49 | notinlistscip-shell shell shell-project 0.0.0 notinlist().() { |
| 50 | for word in $2; do |
| 51 | if [scip-shell system . . `[`. $word = $1 ]; then |
| 52 | return 1 |
| 53 | fi |
| 54 | done |
| 55 | return 0 |
| 56 | } |
| 57 | |
| 58 | ## get all the items that are in list A but not in list B |
| 59 | ## listexclude $A $B $B |
| 60 | listexcludescip-shell shell shell-project 0.0.0 listexclude().() { |
| 61 | for w in "$@"; do |
| 62 | echoscip-shell system . . echo. $w |
| 63 | done | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. -u |
| 64 | } |
| 65 | |
| 66 | runtestscip-shell shell shell-project 0.0.0 runtest().() { |
| 67 | # usage: runtest <logfile> <cmd> <arg1> ... |
| 68 | local logfile=$1 |
| 69 | shift |
| 70 | ("$@" >"${logfile}" 2>&1) && echoscip-shell system . . echo. "OK: '$@' succeeded!" || (catscip-shell system . . cat. "${logfile}" >${verbose}; echoscip-shell system . . echo. "ERROR: '$@' failed") |
| 71 | rmscip-shell system . . rm. -rf good good-faustnode sound |
| 72 | } |
| 73 | |
| 74 | runtestfailscip-shell shell shell-project 0.0.0 runtestfail().() { |
| 75 | # usage: runtestfail <logfile> <cmd> <arg1> ... |
| 76 | local logfile=$1 |
| 77 | shift |
| 78 | ("$@" >"${logfile}" 2>&1) && echoscip-shell system . . echo. "ERROR: '$@' shouldn't have succeeded!" || echoscip-shell system . . echo. "OK: '$@' correctly failed" |
| 79 | rmscip-shell system . . rm. -rf good good-faustnode sound |
| 80 | } |
| 81 | |
| 82 | runtestrefscip-shell shell shell-project 0.0.0 runtestref().() { |
| 83 | # usage: runtestref <logfile> <name> <refbasename> <cmd> <arg1>... |
| 84 | local logfile=$1 |
| 85 | local name=$2 |
| 86 | local referencefile="${3}_ref.txt" |
| 87 | local resultfile="${3}.txt" |
| 88 | shift 3 |
| 89 | if ("$@" >"${logfile}" 2>&1); then |
| 90 | "./${name}" > "${resultfile}" |
| 91 | diffscip-shell system . . diff. "${resultfile}" "${referencefile}" >${verbose} && echoscip-shell system . . echo. "OK: '$@' succeeded!" || (catscip-shell system . . cat. "${logfile}" >${verbose}; echoscip-shell system . . echo. "ERROR: '$@' failed (mismatched output)") |
| 92 | else |
| 93 | catscip-shell system . . cat. "${logfile}" >${verbose} |
| 94 | echoscip-shell system . . echo. "ERROR: '$@' failed" |
| 95 | fi |
| 96 | rmscip-shell system . . rm. -f "${resultfile}" |
| 97 | rmscip-shell system . . rm. -rf "${name}" |
| 98 | } |
| 99 | |
| 100 | echoscip-shell system . . echo. "------------------------" |
| 101 | echoscip-shell system . . echo. Run tests for $system |
| 102 | echoscip-shell system . . echo. "------------------------" |
| 103 | |
| 104 | if [scip-shell system . . `[`. "x${TESTS}" != "x" ]; then |
| 105 | TESTS=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 106 | TESTS_SOUND=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_SOUND} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 107 | TESTS_SOUNDSR=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_SOUNDSR} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 108 | TESTS_MIDI=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_MIDI} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 109 | TESTS_POLY=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_POLY} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 110 | TESTS_POLYMIDI=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_POLYMIDI} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 111 | TESTS_POLY2MIDI=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_POLY2MIDI} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 112 | TESTS_HTTPD=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_HTTPD} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 113 | TESTS_OSC=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_OSC} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 114 | TESTS_OSCHTTPD=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_OSCHTTPD} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 115 | TESTS_PRESET_AUTO=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_PRESET_AUTO} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 116 | TESTS_PRESET_DIR=$(listexcludescip-shell shell shell-project 0.0.0 listexclude(). ${TESTS_PRESET_DIR} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}) |
| 117 | |
| 118 | echoscip-shell system . . echo. "Test:" ${TESTS:---} |
| 119 | echoscip-shell system . . echo. "Test '-midi':" ${TESTS_MIDI:---} |
| 120 | echoscip-shell system . . echo. "Test '-nvoices 8':" ${TESTS_POLY:---} |
| 121 | echoscip-shell system . . echo. "Test '-nvoices 8 -midi':" ${TESTS_POLYMIDI:---} |
| 122 | echoscip-shell system . . echo. "Test '-nvoices 8 -effect <foo.dsp> -midi':" ${TESTS_POLY2MIDI:---} |
| 123 | echoscip-shell system . . echo. "Test '-soundfile':" ${TESTS_SOUND:---} |
| 124 | echoscip-shell system . . echo. "Test '-soundfile -resample':" ${TESTS_SOUNDSR:---} |
| 125 | echoscip-shell system . . echo. "Test '-httpd':" ${TESTS_HTTPD:---} |
| 126 | echoscip-shell system . . echo. "Test '-osc':" ${TESTS_OSC:---} |
| 127 | echoscip-shell system . . echo. "Test '-osc -httpd':" ${TESTS_OSCHTTPD:---} |
| 128 | echoscip-shell system . . echo. "Test '-preset auto':" ${TESTS_PRESET_AUTO:---} |
| 129 | echoscip-shell system . . echo. "Test '-preset preset_dir':" ${TESTS_PRESET_DIR:---} |
| 130 | echoscip-shell system . . echo. "eXcluded test:" ${TESTS_EXCLUDED} |
| 131 | |
| 132 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faust2dummy "${TESTS_EXCLUDED}"; then |
| 133 | runtestrefscip-shell shell shell-project 0.0.0 runtestref(). LOG good good faust2dummy good.dsp |
| 134 | runtestrefscip-shell shell shell-project 0.0.0 runtestref(). LOG good good_midi faust2dummy -midi good.dsp |
| 135 | runtestrefscip-shell shell shell-project 0.0.0 runtestref(). LOG organ organ_2voices faust2dummy -midi -nvoices 2 organ.dsp |
| 136 | runtestrefscip-shell shell shell-project 0.0.0 runtestref(). LOG organ organ_8voices faust2dummy -midi organ.dsp |
| 137 | fi |
| 138 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faust2dummymem "${TESTS_EXCLUDED}"; then |
| 139 | runtestrefscip-shell shell shell-project 0.0.0 runtestref(). LOG waveform4 waveform4 faust2dummymem waveform4.dsp |
| 140 | fi |
| 141 | |
| 142 | for scriptname in $TESTS; do |
| 143 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" good.dsp |
| 144 | done |
| 145 | |
| 146 | for scriptname in $TESTS_MIDI; do |
| 147 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -midi good.dsp |
| 148 | done |
| 149 | |
| 150 | for scriptname in $TESTS_POLY; do |
| 151 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -nvoices 8 good.dsp |
| 152 | done |
| 153 | |
| 154 | for scriptname in $TESTS_POLYMIDI; do |
| 155 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -nvoices 8 -midi good.dsp |
| 156 | done |
| 157 | |
| 158 | for scriptname in $TESTS_POLY2MIDI; do |
| 159 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -nvoices 8 -effect good.dsp -midi good.dsp |
| 160 | done |
| 161 | |
| 162 | for scriptname in $TESTS_SOUND; do |
| 163 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -soundfile -lang ocpp sound.dsp |
| 164 | done |
| 165 | |
| 166 | for scriptname in $TESTS_SOUND; do |
| 167 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -soundfile sound.dsp |
| 168 | done |
| 169 | |
| 170 | for scriptname in $TESTS_SOUNDSR; do |
| 171 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -soundfile -resample sound.dsp |
| 172 | done |
| 173 | |
| 174 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2juce -soundfile -standalone sound.dsp |
| 175 | |
| 176 | for scriptname in $TESTS_HTTPD; do |
| 177 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -httpd good.dsp |
| 178 | done |
| 179 | |
| 180 | for scriptname in $TESTS_OSC; do |
| 181 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -osc good.dsp |
| 182 | done |
| 183 | |
| 184 | for scriptname in $TESTS_OSCHTTPD; do |
| 185 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -osc -httpd good.dsp |
| 186 | done |
| 187 | |
| 188 | for scriptname in $TESTS_PRESET_AUTO; do |
| 189 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -preset auto good.dsp |
| 190 | done |
| 191 | |
| 192 | for scriptname in $TESTS_PRESET_DIR; do |
| 193 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" -preset preset_dir good.dsp |
| 194 | done |
| 195 | |
| 196 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faust2api "${TESTS_EXCLUDED}"; then |
| 197 | (faust2api -jack good.dsp >LOG 2>&1 && unzip dsp-faust.zip && cd dsp-faust && c++scip-shell system . . c++. -std=c++11 DspFaust.cpp -DBUILD -ljack -o DspFaust) && (echoscip-shell system . . echo. "OK: faust2api -jack succeeded !")||(echoscip-shell system . . echo. "ERROR: faust2api -jack failed") |
| 198 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -jack -midi -nvoices 8 good.dsp |
| 199 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -jack -nvoices 8 -effect effect.dsp -midi good.dsp |
| 200 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -jack -soundfile -lang ocpp sound.dsp |
| 201 | # linux only? |
| 202 | if [scip-shell system . . `[`. "$system" = "Linux" ]; then |
| 203 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -android good.dsp |
| 204 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -android -midi good.dsp |
| 205 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -android -midi -nvoices 8 good.dsp |
| 206 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2api -android -nvoices 8 -effect effect.dsp -midi good.dsp |
| 207 | fi |
| 208 | fi |
| 209 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faustnodejs "${TESTS_EXCLUDED}"; then |
| 210 | if [scip-shell system . . `[`. "$system" = "Darwin" ]; then |
| 211 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2nodejs -coreaudio good.dsp |
| 212 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2nodejs -coreaudio -midi good.dsp |
| 213 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2nodejs -coreaudio -midi -nvoices 8 good.dsp |
| 214 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2nodejs -coreaudio -nvoices 8 -effect effect.dsp -midi good.dsp |
| 215 | fi |
| 216 | fi |
| 217 | |
| 218 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faust2smartkeyb "${TESTS_EXCLUDED}"; then |
| 219 | if [scip-shell system . . `[`. "$system" = "Darwin" ]; then |
| 220 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -android good.dsp |
| 221 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -android -nvoices 8 good.dsp |
| 222 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -android -effect effect.dsp -nvoices 8 good.dsp |
| 223 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -ios good.dsp |
| 224 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -ios -osc good.dsp |
| 225 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -ios -osc -nvoices 8 good.dsp |
| 226 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2smartkeyb -ios -effect effect.dsp -nvoices 8 good.dsp |
| 227 | fi |
| 228 | fi |
| 229 | |
| 230 | # Test of -exp10 |
| 231 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faust2jack "${TESTS_EXCLUDED}"; then |
| 232 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG faust2jack -exp10 exp10.dsp |
| 233 | fi |
| 234 | |
| 235 | if notinlistscip-shell shell shell-project 0.0.0 notinlist(). faust2android "${TESTS_EXCLUDED}"; then |
| 236 | runtestfailscip-shell shell shell-project 0.0.0 runtestfail(). faust2android -exp10 exp10.dsp |
| 237 | fi |
| 238 | else # TESTS is empty |
| 239 | echoscip-shell system . . echo. |
| 240 | echoscip-shell system . . echo. "Test all Faust2xxx to work" |
| 241 | echoscip-shell system . . echo. |
| 242 | for scriptname in $(listexcludescip-shell shell shell-project 0.0.0 listexclude(). $(for S in ../../tools/faust2appls/faust2*; do echoscip-shell system . . echo. $(basenamescip-shell system . . basename. "$S" .in); done) ${XLIST1} ${XLIST1} ${TESTS_EXCLUDED} ${TESTS_EXCLUDED}); do |
| 243 | runtestscip-shell shell shell-project 0.0.0 runtest(). LOG "${scriptname}" good.dsp |
| 244 | done |
| 245 | fi |