annotate SCRIPTS/process.sh @ 114:6015c2048c3f

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