annotate SCRIPTS/process.sh @ 86:413a9d26189e

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