annotate SCRIPTS/process.sh @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents fdfd5e9f8a77
children
rev   line source
Chris@1 1 #!/bin/bash
Chris@1 2
Chris@6 3 # Run this from the top-level vamp-build-and-test directory
Chris@6 4
Chris@1 5 ## Things to test:
Chris@1 6 ## the plugin builds!
Chris@1 7 ## plugin loads
Chris@1 8 ## passes vamp-plugin-tester tests
Chris@1 9 ## does not export any unnecessary symbols
Chris@1 10 ## has valid .cat and .n3
Chris@1 11
Chris@88 12 set -e
Chris@86 13
Chris@19 14 mydir=$(dirname "$0")
Chris@19 15 case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
Chris@19 16
Chris@75 17 . "$mydir"/include.sh
Chris@75 18
Chris@57 19 have_all=true
Chris@66 20 for program in make perl git svn hg zip tar ; do
Chris@57 21 if ! $program --version >/dev/null 2>&1; then
Chris@57 22 if ! $program -v 2>&1 | grep -q version; then
Chris@57 23 echo " ** $program program not found"
Chris@57 24 have_all=false
Chris@57 25 fi
Chris@57 26 fi
Chris@57 27 done
Chris@57 28 if [ "$have_all" != "true" ]; then
Chris@57 29 echo "Not all dependencies found, exiting"
Chris@57 30 exit 1
Chris@57 31 fi
Chris@57 32
Chris@22 33 do_rebuild=""
Chris@14 34
Chris@22 35 usage() {
Chris@22 36 echo
Chris@22 37 echo "Usage: $0 <platform> [-c] [<dir> ...]"
Chris@22 38 echo
Chris@73 39 echo " <platform> one of native, linux32, linux64, mingw32, mingw64, osx32, osx64, emscripten"
Chris@22 40 echo " -c build from clean"
Chris@22 41 echo " <dir> directory to build (default is all of them)"
Chris@22 42 echo
Chris@22 43 echo "Platform usually should match the platform you are running this"
Chris@22 44 echo "script on, unless you have a cross-compile toolset installed and"
Chris@31 45 echo "this script knows how to run it. The special platform 'native'"
Chris@31 46 echo "tries to guess the currently running platform."
Chris@22 47 echo
Chris@22 48 exit 2
Chris@22 49 }
Chris@21 50
Chris@31 51 platform_arg="$1"
Chris@109 52 platform_native="unknown"
Chris@109 53 case `uname -a` in
Chris@109 54 Linux*x86_64*) platform_native=linux64;;
Chris@109 55 Linux*) platform_native=linux32;;
Chris@109 56 Darwin*) platform_native=osx64;;
Chris@109 57 CYG*) platform_native=mingw32;;
Chris@109 58 MINGW*) platform_native=mingw32;;
Chris@109 59 esac
Chris@31 60
Chris@31 61 if [ "$platform_arg" = "native" ]; then
Chris@109 62 platform_arg="$platform_native"
Chris@31 63 fi
Chris@31 64
Chris@78 65 platform=
Chris@110 66 platform_defines=("UNUSED_=") # Avoid passing empty arg to make as if target
Chris@114 67 pubtag=
Chris@78 68 bits=32
Chris@78 69 altbits=
Chris@78 70 toolprefix=
Chris@78 71 pluginext=
Chris@78 72 hostwrapper=
Chris@78 73 hostext=
Chris@78 74 valgrind=
Chris@78 75 archflags=
Chris@78 76 identpattern=
Chris@96 77 sep=":"
Chris@78 78
Chris@31 79 case "$platform_arg" in
Chris@22 80 linux32)
Chris@22 81 platform=linux
Chris@114 82 pubtag=linux32
Chris@109 83 if [ "$platform_native" = "linux64" ]; then
Chris@109 84 toolprefix=x86_64-unknown-linux-gnu-
Chris@109 85 platform_defines=("CXX=${toolprefix}g++ -m32" "CC=${toolprefix}gcc -m32" "LD=${toolprefix}g++ -m32")
Chris@109 86 fi
Chris@22 87 pluginext=.so
Chris@38 88 valgrind=valgrind
Chris@42 89 identpattern='ELF 32'
Chris@22 90 ;;
Chris@22 91 linux64)
Chris@22 92 platform=linux
Chris@22 93 bits=64
Chris@114 94 pubtag=linux64
Chris@22 95 pluginext=.so
Chris@38 96 valgrind=valgrind
Chris@42 97 identpattern='ELF 64'
Chris@22 98 ;;
Chris@22 99 mingw32)
Chris@22 100 platform=mingw
Chris@114 101 pubtag=win32
Chris@22 102 toolprefix=i686-w64-mingw32-
Chris@22 103 pluginext=.dll
Chris@22 104 hostwrapper=wine
Chris@22 105 hostext=.exe
Chris@36 106 identpattern='PE32.*386.*Windows'
Chris@96 107 sep=";"
Chris@22 108 ;;
Chris@22 109 mingw64)
Chris@22 110 platform=mingw
Chris@22 111 bits=64
Chris@114 112 pubtag=win64
Chris@78 113 altbits=32 # We can usually use a mingw32 Makefile if toolprefix is OK
Chris@22 114 toolprefix=x86_64-w64-mingw32-
Chris@22 115 pluginext=.dll
Chris@22 116 hostwrapper=wine
Chris@22 117 hostext=.exe
Chris@78 118 identpattern='PE32.*x86-64.*Windows'
Chris@96 119 sep=";"
Chris@22 120 ;;
Chris@22 121 osx32)
Chris@22 122 platform=osx
Chris@114 123 pubtag=osx32
Chris@22 124 pluginext=.dylib
Chris@22 125 archflags="-arch i386"
Chris@40 126 identpattern='Mach-O .*i386'
Chris@22 127 ;;
Chris@22 128 osx64)
Chris@22 129 platform=osx
Chris@22 130 bits=64
Chris@114 131 pubtag=osx
Chris@22 132 pluginext=.dylib
Chris@26 133 # This is a difficult choice for various reasons... have to ponder
Chris@107 134 archflags="-mmacosx-version-min=10.7 -arch x86_64 -arch i386 -stdlib=libc++"
Chris@40 135 identpattern='Mach-O 64-bit .*x86_64'
Chris@22 136 ;;
Chris@73 137 emscripten)
Chris@73 138 platform=emscripten
Chris@73 139 bits=32
Chris@73 140 toolprefix=
Chris@73 141 pluginext=.so
Chris@73 142 hostwrapper=
Chris@73 143 hostext=
Chris@73 144 makewrapper=emmake
Chris@73 145 configwrapper=emconfigure
Chris@73 146 valgrind=
Chris@73 147 archflags=
Chris@73 148 identpattern='not known yet'
Chris@118 149 ;;
Chris@88 150 *)
Chris@88 151 usage
Chris@88 152 ;;
Chris@22 153 esac;
Chris@22 154
Chris@22 155 shift
Chris@22 156
Chris@22 157 if [ -z "$platform" ]; then
Chris@22 158 usage
Chris@22 159 else
Chris@114 160 echo "(Platform is $platform, $bits bits, package platform tag $pubtag)"
Chris@22 161 fi
Chris@22 162
Chris@78 163 if [ -z "$pluginext" ]; then
Chris@78 164 echo "Internal error: pluginext not set for platform $platform" 1>&2
Chris@78 165 exit 2
Chris@78 166 fi
Chris@78 167
Chris@78 168 if [ -z "$identpattern" ]; then
Chris@78 169 echo "Internal error: identpattern not set for platform $platform" 1>&2
Chris@78 170 exit 2
Chris@78 171 fi
Chris@78 172
Chris@22 173 if [ t"$1" = t"-c" ]; then
Chris@22 174 echo "(Building from clean)"
Chris@22 175 do_rebuild=yes
Chris@22 176 shift
Chris@22 177 fi
Chris@15 178
Chris@91 179 metadir="$mydir"/../METADATA
Chris@91 180
Chris@19 181 depincdir="$mydir"/../DEPENDENCIES/$platform$bits/include
Chris@19 182 deplibdir="$mydir"/../DEPENDENCIES/$platform$bits/lib
Chris@88 183 depincdir_generic="$mydir"/../DEPENDENCIES/generic/include
Chris@19 184
Chris@88 185 pyver=27
Chris@88 186 pyincdir="$mydir"/../DEPENDENCIES/$platform$bits/Python$pyver/include
Chris@88 187 numpyincdir="$mydir"/../DEPENDENCIES/$platform$bits/Python$pyver/Lib/site-packages/numpy/core/include
Chris@88 188 pylibdir="$mydir"/../DEPENDENCIES/$platform$bits/Python$pyver/libs
Chris@1 189
Chris@11 190 plugindirs="$@"
Chris@11 191 if [ -z "$plugindirs" ]; then
Chris@100 192 plugindirs=$(cat METADATA/repos.txt | grep -v vamp-plugin-sdk | grep -v vamp-plugin-tester | awk '{ print $1; }')
Chris@61 193 else
Chris@61 194 for dir in $plugindirs ; do
Chris@61 195 if [ ! -d "$dir" ]; then
Chris@61 196 echo "ERROR: Directory $dir not found"
Chris@61 197 usage
Chris@61 198 fi
Chris@61 199 done
Chris@11 200 fi
Chris@11 201
Chris@88 202 set -u
Chris@88 203
Chris@6 204 reportdir="REPORTS/$platform$bits"
Chris@49 205 packagedir="PACKAGES/$platform$bits"
Chris@49 206
Chris@49 207 mkdir -p "$reportdir" "$packagedir" || exit 1
Chris@6 208
Chris@9 209 built="/tmp/built.$$.txt"
Chris@9 210 testfailed="/tmp/testfailed.$$.txt"
Chris@19 211 envcheckfailed="/tmp/envcheckfailed.$$.txt"
Chris@9 212 notbuilt="/tmp/notbuilt.$$.txt"
Chris@49 213
Chris@19 214 trap 'rm -f "$built" "$envcheckfailed" "$testfailed" "$notbuilt"' 0
Chris@19 215 touch "$built" "$envcheckfailed" "$testfailed" "$notbuilt"
Chris@9 216
Chris@86 217 target_for() {
Chris@86 218 local dir="$1"
Chris@91 219 if grep -q "^$dir: " ${metadir}/maketarget.txt ; then
Chris@91 220 grep "^$dir: " ${metadir}/maketarget.txt | head -1 | sed 's/^[^:]*: //'
Chris@86 221 fi
Chris@86 222 }
Chris@86 223
Chris@109 224 custom_plugin_dir_for() {
Chris@86 225 local dir="$1"
Chris@91 226 if grep -q "^$dir: " ${metadir}/plugindir.txt ; then
Chris@91 227 echo "${mydir}/../${dir}"/$(grep "^$dir: " ${metadir}/plugindir.txt | head -1 | sed 's/^[^:]*: //')
Chris@86 228 fi
Chris@86 229 }
Chris@86 230
Chris@109 231 plugin_dir_for() {
Chris@109 232 local dir="$1"
Chris@109 233 local pdir=$(custom_plugin_dir_for "$dir")
Chris@109 234 if [ -z "$pdir" ]; then
Chris@109 235 case "$dir" in
Chris@109 236 /*) pdir="$dir" ;;
Chris@109 237 *) pdir="${mydir}/../${dir}";;
Chris@109 238 esac
Chris@109 239 fi
Chris@109 240 echo "$pdir"
Chris@109 241 }
Chris@109 242
Chris@4 243 configure() {
Chris@86 244 local dir="$1"
Chris@4 245 if [ -f "$dir/configure" ] ; then
Chris@73 246 ( cd "$dir" ; $configwrapper ./configure ) 2>&1 | \
Chris@73 247 tee "$reportdir/$dir.configure.txt"
Chris@73 248 return ${PIPESTATUS[0]}
Chris@4 249 fi
Chris@4 250 }
Chris@4 251
Chris@1 252 find_makefile() {
Chris@86 253 local dir="$1"
Chris@9 254 for f in \
Chris@19 255 build/$platform$bits/Makefile.$platform$bits \
Chris@13 256 build/$platform/Makefile.$platform$bits \
Chris@19 257 build/$platform$bits/Makefile.$platform \
Chris@19 258 build/$platform$bits/Makefile \
Chris@19 259 build/Makefile.$platform$bits \
Chris@19 260 Makefile.$platform$bits \
Chris@13 261 build/$platform/Makefile.$platform \
Chris@13 262 build/$platform/Makefile \
Chris@13 263 build/Makefile.$platform \
Chris@9 264 Makefile.$platform \
Chris@78 265 build/$platform$altbits/Makefile.$platform$altbits \
Chris@78 266 build/$platform/Makefile.$platform$altbits \
Chris@78 267 build/$platform$altbits/Makefile.$platform \
Chris@78 268 build/$platform$altbits/Makefile \
Chris@78 269 build/Makefile.$platform$altbits \
Chris@78 270 Makefile.$platform$altbits \
Chris@13 271 Makefile ; do
Chris@1 272 if [ -f "$dir/$f" ]; then
Chris@1 273 echo $f
Chris@1 274 break
Chris@1 275 fi
Chris@1 276 done
Chris@1 277 }
Chris@1 278
Chris@86 279 find_vampy_plugins_in() {
Chris@86 280 local dir="$1"
Chris@86 281 local pdir=$(plugin_dir_for "$dir")
Chris@86 282 find "$pdir" -name \*.py -print0 | xargs -0 grep -l 'import.*\bvampy\b'
Chris@86 283 }
Chris@86 284
Chris@86 285 have_vampy_plugins() {
Chris@86 286 local dir="$1"
Chris@86 287 local plugs=$(find_vampy_plugins_in "$dir")
Chris@86 288 if [ -z "$plugs" ]; then
Chris@86 289 return 1
Chris@86 290 else
Chris@86 291 return 0
Chris@86 292 fi
Chris@86 293 }
Chris@86 294
Chris@13 295 configure_maybe() {
Chris@86 296 local dir="$1"
Chris@43 297 if [ t"$do_rebuild" = t"yes" ]; then
Chris@43 298 configure "$dir"
Chris@43 299 else
Chris@43 300 mfile=$(find_makefile "$dir")
Chris@43 301 if [ -z "$mfile" ]; then
Chris@43 302 configure "$dir"
Chris@43 303 fi
Chris@13 304 fi
Chris@13 305 }
Chris@13 306
Chris@44 307 logfile_for() {
Chris@86 308 local activity="$1"
Chris@86 309 local dir="$2"
Chris@44 310 echo "$reportdir/$dir.$activity.txt"
Chris@44 311 }
Chris@44 312
Chris@4 313 build() {
Chris@86 314 local dir="$1"
Chris@86 315 local log=$(logfile_for build "$dir")
Chris@1 316 if configure_maybe "$dir"; then
Chris@1 317 mfile=$(find_makefile "$dir")
Chris@1 318 if [ -n "$mfile" ]; then
Chris@19 319 target=$(target_for "$dir")
Chris@19 320 TOOLPREFIX="$toolprefix" \
Chris@90 321 CXXFLAGS="-I${depincdir} -I${pyincdir} -I${numpyincdir} -I${depincdir_generic} -I${mydir}/../vamp-plugin-sdk" \
Chris@90 322 LDFLAGS="-L${deplibdir} -L${pylibdir} -L${mydir}/../vamp-plugin-sdk" \
Chris@21 323 ARCHFLAGS="$archflags" \
Chris@117 324 $makewrapper make -C "$dir" -f "$mfile" $target "${platform_defines[@]}" 2>&1 | \
Chris@44 325 tee "$log"
Chris@9 326 return ${PIPESTATUS[0]}
Chris@86 327 elif have_vampy_plugins "$dir"; then
Chris@86 328 return 0
Chris@1 329 else
Chris@88 330 echo "*** Failed to find a Makefile in $dir!" | tee "$log"
Chris@4 331 return 1
Chris@1 332 fi
Chris@1 333 fi
Chris@4 334 }
Chris@4 335
Chris@4 336 rebuild() {
Chris@86 337 local dir="$1"
Chris@86 338 local log=$(logfile_for build "$dir")
Chris@13 339 if configure_maybe "$dir"; then
Chris@4 340 mfile=$(find_makefile "$dir")
Chris@4 341 if [ -n "$mfile" ]; then
Chris@117 342 if $makewrapper make -C "$dir" -f "$mfile" distclean; then
Chris@77 343 build "$dir"
Chris@117 344 elif $makewrapper make -C "$dir" -f "$mfile" clean; then
Chris@32 345 build "$dir"
Chris@32 346 else
Chris@88 347 echo "*** Failed to 'make clean' in $dir!" | tee "$log"
Chris@32 348 return 1
Chris@32 349 fi
Chris@86 350 elif have_vampy_plugins "$dir"; then
Chris@86 351 return 0
Chris@4 352 else
Chris@88 353 echo "*** Failed to find a Makefile in $dir!" | tee "$log"
Chris@4 354 return 1
Chris@4 355 fi
Chris@4 356 fi
Chris@4 357 }
Chris@4 358
Chris@22 359 build_or_rebuild() {
Chris@86 360 local dir="$1"
Chris@22 361 if [ -n "$do_rebuild" ]; then
Chris@22 362 rebuild "$dir"
Chris@22 363 else
Chris@22 364 build "$dir"
Chris@22 365 fi
Chris@22 366 }
Chris@22 367
Chris@19 368 have_plugin() {
Chris@86 369 local dir="$1"
Chris@86 370 local log=$(logfile_for build "$dir")
Chris@19 371 for x in "$dir/"*"$pluginext"; do
Chris@19 372 if [ -f "$x" ]; then
Chris@36 373 if file "$x" | grep -q "$identpattern" ; then
Chris@36 374 return 0
Chris@36 375 else
Chris@44 376 echo "Plugin $x exists, but fails to match file type for correct platform (file type is: `file $x`, expected pattern is: $identpattern)" | tee "$log"
Chris@36 377 return 1
Chris@36 378 fi
Chris@19 379 fi
Chris@19 380 done
Chris@86 381 have_vampy_plugins "$dir"
Chris@19 382 }
Chris@19 383
Chris@19 384 is_nondeterministic() {
Chris@19 385 plugin_id="$1"
Chris@91 386 grep -q "^$id\$" ${metadir}/nondeterministic.txt
Chris@19 387 }
Chris@19 388
Chris@44 389 plugin_ids_in() {
Chris@86 390 local dir="$1"
Chris@86 391 local pdir=$(plugin_dir_for "$dir")
Chris@86 392 local vampydir=""
Chris@86 393 if have_vampy_plugins "$pdir"; then
Chris@86 394 vampydir="./vampy"
Chris@86 395 fi
Chris@40 396 # can't use sed to remove \r from DOS line endings -- BSD and GNU
Chris@44 397 # vary in how they interpret \r escape -- so we use perl for that...
Chris@109 398 VAMP_PATH="$pdir$sep$vampydir" $hostwrapper \
Chris@44 399 vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | \
Chris@44 400 grep '^vamp:' | \
Chris@44 401 sed 's/^vamp://' | \
Chris@44 402 perl -p -e 's/\r//g'
Chris@44 403 }
Chris@44 404
Chris@44 405 run_tester() {
Chris@44 406 ##!!! todo: timeout if the plugin takes too long and report as failure
Chris@86 407 local dir="$1"
Chris@86 408 local log=$(logfile_for test "$dir")
Chris@86 409 local ids=$(plugin_ids_in "$dir")
Chris@86 410 local pdir=$(plugin_dir_for "$dir")
Chris@44 411 cat /dev/null > "$log"
Chris@6 412 if [ -z "$ids" ]; then
Chris@6 413 echo
Chris@44 414 echo "No plugins reported to test in $dir" | tee -a "$log"
Chris@44 415 echo "$dir" >> "$testfailed"
Chris@44 416 return 1
Chris@44 417 fi
Chris@44 418 good=yes
Chris@44 419 for id in $ids; do
Chris@44 420 extra=""
Chris@44 421 if is_nondeterministic "$id"; then
Chris@44 422 extra="-n"
Chris@44 423 fi
Chris@109 424 echo "Running command: VAMP_PATH=\"$pdir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log"
Chris@109 425 if ( VAMP_PATH="$pdir$sep./vampy" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then
Chris@62 426 echo "OK" | tee -a "$log"
Chris@44 427 else
Chris@86 428 if have_vampy_plugins "$pdir"; then # (don't attempt vampy+valgrind)
Chris@86 429 echo | tee -a "$log"
Chris@86 430 echo "Tester failed for id $id (not restarting with valgrind, as this is a VamPy plugin)" | tee -a "$log"
Chris@86 431 else
Chris@86 432 echo | tee -a "$log"
Chris@86 433 echo "Tester failed for id $id: running again with valgrind (if available) and verbose for a report..." | tee -a "$log"
Chris@109 434 VAMP_PATH="$pdir$sep./vampy" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log"
Chris@86 435 fi
Chris@44 436 good=no
Chris@44 437 fi
Chris@44 438 done
Chris@44 439 if [ "$good" != "yes" ]; then
Chris@23 440 echo "$dir" >> "$testfailed"
Chris@6 441 return 1
Chris@5 442 else
Chris@44 443 return 0
Chris@5 444 fi
Chris@5 445 }
Chris@5 446
Chris@44 447 public_symbols_in() {
Chris@9 448 lib="$1"
Chris@23 449 # nm -g prints global symbols in both OS/X and GNU tools, but
Chris@23 450 # printing only global *defined* symbols is harder. In GNU it is
Chris@23 451 # nm -g --defined-only; the OS/X docs suggest nm -gu should work,
Chris@23 452 # but it doesn't. What I think will work with both is simply
Chris@23 453 # grepping out the undefineds:
Chris@109 454 nm="${toolprefix}nm"
Chris@109 455 if ! type -path "$nm" >/dev/null; then nm=nm; fi
Chris@109 456 "$nm" -g "$lib" | grep -v ' U ' | awk '{ print $3; }'
Chris@9 457 }
Chris@9 458
Chris@44 459 env_test_exports() {
Chris@86 460 local dir="$1"
Chris@86 461 local log=$(logfile_for envtest "$dir")
Chris@86 462 local good=yes
Chris@44 463 for lib in "$dir"/*"$pluginext"; do
Chris@44 464 if [ ! -f "$lib" ]; then
Chris@44 465 # This should only happen if the glob was not expanded at all
Chris@44 466 echo "NOTE: no library found in $dir?" | tee -a "$log"
Chris@44 467 good=no
Chris@44 468 break
Chris@44 469 fi
Chris@44 470 echo
Chris@44 471 echo "Testing for exported symbols in $lib..."
Chris@44 472 if public_symbols_in "$lib" | grep -q vampGetPluginDescriptor; then
Chris@44 473 others=`public_symbols_in "$lib" | grep -v vampGetPluginDescriptor`
Chris@44 474 if [ -n "$others" ]; then
Chris@44 475 count=`echo "$others" | wc -l`
Chris@44 476 echo "ERROR: library $lib exports $count extra symbols in addition to vampGetPluginDescriptor" | tee -a "$log"
Chris@44 477 good=no
Chris@44 478 else
Chris@44 479 echo "GOOD: library $lib only exports vampGetPluginDescriptor" | tee -a "$log"
Chris@44 480 fi
Chris@44 481 else
Chris@44 482 echo "NOTE: found library $lib that is not a Vamp plugin library" | tee -a "$log"
Chris@44 483 fi
Chris@44 484 done
Chris@44 485 [ "$good" = "yes" ]
Chris@44 486 }
Chris@44 487
Chris@44 488 env_test_stdout() {
Chris@86 489 local dir="$1"
Chris@86 490 local log=$(logfile_for envtest "$dir")
Chris@86 491 local pdir=$(plugin_dir_for "$dir")
Chris@86 492 local good=yes
Chris@109 493 local ids=$(VAMP_PATH="$pdir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids);
Chris@44 494 echo
Chris@44 495 echo "Testing for any unwanted output to stdout..."
Chris@44 496 for id in $ids; do
Chris@44 497 case "$id" in
Chris@44 498 vamp:*) ;;
Chris@44 499 *)
Chris@44 500 echo "ERROR: plugin in $dir prints to stdout as it runs: found text $id (should use stderr for debug logging to avoid mixing with batch output stream)" | tee -a "$log"
Chris@44 501 good=no
Chris@44 502 ;;
Chris@44 503 esac
Chris@44 504 done
Chris@44 505 [ "$good" = "yes" ]
Chris@44 506 }
Chris@44 507
Chris@44 508 env_test_cat() {
Chris@86 509 local dir="$1"
Chris@86 510 local log=$(logfile_for envtest "$dir")
Chris@109 511 local pdir=$(custom_plugin_dir_for "$dir")
Chris@86 512 local cdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi)
Chris@86 513 local good=yes
Chris@86 514 local first=yes
Chris@44 515 echo
Chris@44 516 echo "Testing some details of .cat files..."
Chris@80 517 for catfile in "$cdir"/*".cat"; do
Chris@44 518 if [ ! -f "$catfile" ]; then
Chris@44 519 # This should only happen if the glob was not expanded at all
Chris@44 520 echo "ERROR: no .cat file found in $dir" | tee -a "$log"
Chris@44 521 good=no
Chris@44 522 break
Chris@44 523 fi
Chris@44 524 if [ "$first" = "yes" ]; then
Chris@44 525 first=no
Chris@44 526 else
Chris@80 527 echo "NOTE: multiple .cat files found in $cdir" | tee -a "$log"
Chris@44 528 fi
Chris@44 529 done
Chris@44 530 if [ "$good" = "yes" ]; then
Chris@46 531 excess=$(plugin_ids_in "$dir" | sed 's/^/vamp:/' | \
Chris@85 532 cat - "$cdir"/*".cat" | \
Chris@47 533 sed 's/::.*//' | \
Chris@47 534 sort | \
Chris@47 535 uniq -u)
Chris@44 536 if [ -n "$excess" ]; then
Chris@47 537 echo "ERROR: excess or missing definitions in .cat file? $excess" | tee -a "$log"
Chris@44 538 good=no
Chris@44 539 else
Chris@47 540 echo "GOOD: no excess or missing definitions in .cat files" | tee -a "$log"
Chris@44 541 fi
Chris@44 542 fi
Chris@44 543 [ "$good" = "yes" ]
Chris@44 544 }
Chris@44 545
Chris@44 546 env_test_ttl() {
Chris@86 547 local dir="$1"
Chris@86 548 local log=$(logfile_for envtest "$dir")
Chris@109 549 local pdir=$(custom_plugin_dir_for "$dir")
Chris@86 550 local rdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi)
Chris@86 551 local good=yes
Chris@86 552 local first=yes
Chris@44 553 echo
Chris@44 554 echo "Testing existence of RDF files..."
Chris@80 555 for ttlfile in "$rdir"/*.{n3,ttl}; do
Chris@44 556 if [ ! -f "$ttlfile" ]; then
Chris@44 557 # Because we have two different extensions, this isn't an
Chris@44 558 # error as it is with e.g. .cat (because one or the other
Chris@44 559 # of .n3 and .ttl almost certainly won't exist). But if we
Chris@44 560 # drop out the bottom and first is still true, then we
Chris@44 561 # know neither matched.
Chris@44 562 :
Chris@44 563 elif [ "$first" = "yes" ]; then
Chris@44 564 first=no
Chris@44 565 else
Chris@80 566 echo "NOTE: multiple .ttl or .n3 files found in $rdir" | tee -a "$log"
Chris@44 567 fi
Chris@44 568 done
Chris@80 569 if [ "$first" = "yes" ]; then
Chris@80 570 echo "ERROR: no .ttl or .n3 files found in $rdir" | tee -a "$log"
Chris@45 571 good=no;
Chris@45 572 else
Chris@45 573 echo "GOOD: found one or more .ttl or .n3 files (we don't actually test their validity or content here though)" | tee -a "$log"
Chris@45 574 fi
Chris@45 575 [ "$good" = "yes" ]
Chris@45 576 }
Chris@45 577
Chris@45 578 env_test_accompaniments() {
Chris@86 579 local dir="$1"
Chris@86 580 local log=$(logfile_for envtest "$dir")
Chris@86 581 local good=yes
Chris@46 582 echo
Chris@46 583 echo "Testing existence of README and accompanying files..."
Chris@66 584 if ! ls -1 "$dir" | egrep -qi "^readme(.txt)?$"; then
Chris@45 585 echo "ERROR: no README file found" | tee -a "$log"
Chris@45 586 good=no
Chris@45 587 fi
Chris@53 588 if ! ls -1 "$dir" | egrep -qi "^(copying|licen[cs]e)(.txt)?$"; then
Chris@45 589 echo "ERROR: no COPYING or LICEN[CS]E file found" | tee -a "$log"
Chris@45 590 good=no
Chris@45 591 fi
Chris@53 592 if ! ls -1 "$dir" | egrep -qi "^citation(.txt)?$"; then
Chris@45 593 echo "NOTE: no CITATION file found" | tee -a "$log"
Chris@45 594 fi
Chris@44 595 [ "$good" = "yes" ]
Chris@44 596 }
Chris@44 597
Chris@9 598 run_environmental_tests() {
Chris@86 599 local dir="$1"
Chris@86 600 local log=$(logfile_for envtest "$dir")
Chris@86 601 local allgood=yes
Chris@44 602 cat /dev/null > "$log"
Chris@45 603 for test in exports stdout cat ttl accompaniments; do
Chris@44 604 "env_test_$test" "$dir" || allgood=no
Chris@9 605 done
Chris@44 606 if [ "$allgood" != "yes" ]; then
Chris@19 607 echo "$dir" >> "$envcheckfailed"
Chris@44 608 return 1
Chris@44 609 else
Chris@44 610 return 0
Chris@19 611 fi
Chris@9 612 }
Chris@4 613
Chris@49 614 package() {
Chris@86 615 local dir="$1"
Chris@86 616 local id=$(vcs_id "$dir")
Chris@114 617 local pstub="$dir-$pubtag-$id"
Chris@86 618 local pdir="$packagedir/$pstub"
Chris@49 619 mkdir -p "$pdir"
Chris@49 620 ( cd "$dir" ;
Chris@49 621 cp -av \
Chris@49 622 *"$pluginext" \
Chris@49 623 *.cat \
Chris@49 624 *.n3 \
Chris@49 625 *.ttl \
Chris@49 626 [Rr][Ee][Aa][Dd][Mm][Ee]* \
Chris@49 627 [Cc][Oo][Pp][Yy][Ii][Nn][Gg]* \
Chris@49 628 [Ll][Ii][Cc][Ee][Nn][CcSs][Ee]* \
Chris@49 629 [Cc][Ii][Tt][Aa][Tt][Ii][Oo][Nn]* \
Chris@49 630 [Cc][Hh][Aa][Nn][Gg][Ee][Ll][Oo][Gg]* \
Chris@105 631 ../"$pdir"/ || true
Chris@86 632 if have_vampy_plugins "$dir"; then
Chris@86 633 find_vampy_plugins_in "$dir" | while read p; do
Chris@86 634 cp -av "$p" ../"$pdir"/
Chris@86 635 done
Chris@86 636 fi
Chris@49 637 )
Chris@49 638 ( cd "$packagedir";
Chris@49 639 if [ "$platform" = "mingw" ]; then
Chris@54 640 zip -r "$pstub".zip "$pstub"
Chris@49 641 else
Chris@53 642 tar cvjf "$pstub".tar.bz2 "$pstub"
Chris@49 643 fi;
Chris@53 644 rm -rf "$pstub"
Chris@49 645 )
Chris@49 646 }
Chris@49 647
Chris@22 648 if ! build_or_rebuild "vamp-plugin-sdk"; then
Chris@88 649 echo "*** Failed to build Vamp plugin SDK!"
Chris@5 650 exit 1
Chris@5 651 fi
Chris@5 652
Chris@26 653 # Ensure we can only link statically against these
Chris@26 654 for x in vamp-hostsdk vamp-sdk; do
Chris@26 655 for y in dylib dll so; do
Chris@26 656 rm -f "vamp-plugin-sdk/lib$x.$y"
Chris@26 657 rm -f "vamp-plugin-sdk/$x.$y"
Chris@26 658 done
Chris@26 659 done
Chris@26 660
Chris@22 661 if ! build_or_rebuild "vamp-plugin-tester"; then
Chris@88 662 echo "*** Failed to build Vamp plugin tester!"
Chris@5 663 exit 1
Chris@5 664 fi
Chris@5 665
Chris@88 666 need_vampy=no
Chris@88 667 for dir in $plugindirs ; do
Chris@88 668 if have_vampy_plugins "$dir"; then
Chris@88 669 need_vampy=yes
Chris@88 670 break
Chris@88 671 fi
Chris@88 672 done
Chris@88 673 if [ "$need_vampy" = "yes" ] && [ "$plugindirs" != "vampy" ]; then
Chris@88 674 if ! build_or_rebuild "vampy"; then
Chris@88 675 echo "*** Failed to build VamPy! (needed for other plugins)"
Chris@88 676 exit 1
Chris@88 677 fi
Chris@88 678 fi
Chris@88 679
Chris@11 680 for dir in $plugindirs ; do
Chris@31 681 dir=${dir%/*}
Chris@4 682 echo
Chris@4 683 echo "Processing: $dir"
Chris@31 684 if [ ! -d "$dir" ]; then
Chris@31 685 echo "Directory $dir not found!"
Chris@31 686 echo "$dir" >> "$notbuilt"
Chris@31 687 elif build_or_rebuild "$dir"; then
Chris@19 688 if have_plugin "$dir" ; then
Chris@19 689 echo "$dir" >> "$built"
Chris@86 690 if ! run_tester "$dir"; then
Chris@86 691 echo "Tester failed for $dir"
Chris@86 692 fi
Chris@86 693 if ! run_environmental_tests "$dir"; then
Chris@86 694 echo "Environmental tests failed for $dir"
Chris@86 695 fi
Chris@19 696 else
Chris@44 697 log=$(logfile_for build "$dir")
Chris@44 698 echo "Build apparently succeeded, but no resulting plugin(s) found, or plugin(s) have wrong file type or platform" | tee -a "$log"
Chris@19 699 echo "$dir" >> "$notbuilt"
Chris@19 700 fi
Chris@4 701 else
Chris@6 702 echo "$dir" >> "$notbuilt"
Chris@4 703 fi
Chris@44 704 slog=$(logfile_for summary "$dir")
Chris@86 705 echo "initialising logfile $slog for $dir"
Chris@44 706 cat /dev/null > "$slog"
Chris@1 707 done
Chris@1 708
Chris@49 709 cat "$built" | while read dir; do
Chris@49 710 package "$dir"
Chris@49 711 done
Chris@49 712
Chris@4 713 echo
Chris@49 714 echo "** Built, tested, checked, and packaged:"
Chris@44 715 cat "$built" | while read dir; do
Chris@44 716 slog=$(logfile_for summary "$dir")
Chris@44 717 if ! grep -q "^$dir\$" "$testfailed"; then
Chris@44 718 if ! grep -q "^$dir\$" "$envcheckfailed"; then
Chris@44 719 echo "$dir"
Chris@59 720 echo "$dir: OK: Success" >> "$slog"
Chris@32 721 fi
Chris@6 722 fi
Chris@6 723 done | sort
Chris@4 724
Chris@4 725 echo
Chris@19 726 echo "** Failed tests:"
Chris@44 727 cat "$testfailed" | sort | uniq | while read dir; do
Chris@44 728 slog=$(logfile_for summary "$dir")
Chris@44 729 echo "$dir"
Chris@59 730 echo "$dir: TEST_FAILED: Built successfully, but failed tests" >> "$slog"
Chris@6 731 done
Chris@5 732
Chris@5 733 echo
Chris@19 734 echo "** Failed environmental checks:"
Chris@44 735 cat "$envcheckfailed" | sort | uniq | while read dir; do
Chris@44 736 slog=$(logfile_for summary "$dir")
Chris@44 737 echo "$dir"
Chris@59 738 echo "$dir: ENV_FAILED: Built successfully, but failed environmental checks" >> "$slog"
Chris@19 739 done
Chris@19 740
Chris@19 741 echo
Chris@4 742 echo "** Failed to build:"
Chris@44 743 cat "$notbuilt" | sort | while read dir; do
Chris@44 744 slog=$(logfile_for summary "$dir")
Chris@44 745 echo "$dir"
Chris@59 746 echo "$dir: BUILD_FAILED: Failed to compile" >> "$slog"
Chris@6 747 done
Chris@4 748
Chris@4 749 echo