annotate SCRIPTS/process.sh @ 107:e4c146b6e491

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