annotate SCRIPTS/process.sh @ 125:34e428693f5d vext

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