annotate SCRIPTS/process.sh @ 133:4acb5d8d80b6 tip

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