annotate SCRIPTS/process.sh @ 90:1710ac3f246f

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