annotate SCRIPTS/process.sh @ 110:dcbcbbc20109

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