Mercurial > hg > vamp-build-and-test
comparison SCRIPTS/process.sh @ 80:dc4da16ace47
Cope with directories that (like VamPy) have actual plugins in a subdir. Also update subrepos.
author | Chris Cannam |
---|---|
date | Mon, 17 Nov 2014 13:00:08 +0000 |
parents | ab0dbbb58119 |
children | 5936362b8a40 |
comparison
equal
deleted
inserted
replaced
79:71000cf7f414 | 80:dc4da16ace47 |
---|---|
222 if grep -q "^$dir: " METADATA/maketarget.txt ; then | 222 if grep -q "^$dir: " METADATA/maketarget.txt ; then |
223 grep "^$dir: " METADATA/maketarget.txt | head -1 | sed 's/^[^:]*: //' | 223 grep "^$dir: " METADATA/maketarget.txt | head -1 | sed 's/^[^:]*: //' |
224 fi | 224 fi |
225 } | 225 } |
226 | 226 |
227 plugin_dir_for() { | |
228 dir="$1" | |
229 if grep -q "^$dir: " METADATA/plugindir.txt ; then | |
230 echo "$dir"/$(grep "^$dir: " METADATA/plugindir.txt | head -1 | sed 's/^[^:]*: //') | |
231 fi | |
232 } | |
233 | |
227 logfile_for() { | 234 logfile_for() { |
228 activity="$1" | 235 activity="$1" |
229 dir="$2" | 236 dir="$2" |
230 echo "$reportdir/$dir.$activity.txt" | 237 echo "$reportdir/$dir.$activity.txt" |
231 } | 238 } |
302 grep -q "^$id\$" METADATA/nondeterministic.txt | 309 grep -q "^$id\$" METADATA/nondeterministic.txt |
303 } | 310 } |
304 | 311 |
305 plugin_ids_in() { | 312 plugin_ids_in() { |
306 dir="$1" | 313 dir="$1" |
314 pdir=$(plugin_dir_for "$dir") | |
307 # can't use sed to remove \r from DOS line endings -- BSD and GNU | 315 # can't use sed to remove \r from DOS line endings -- BSD and GNU |
308 # vary in how they interpret \r escape -- so we use perl for that... | 316 # vary in how they interpret \r escape -- so we use perl for that... |
309 VAMP_PATH="$dir" $hostwrapper \ | 317 VAMP_PATH="$dir:$pdir" $hostwrapper \ |
310 vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | \ | 318 vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | \ |
311 grep '^vamp:' | \ | 319 grep '^vamp:' | \ |
312 sed 's/^vamp://' | \ | 320 sed 's/^vamp://' | \ |
313 perl -p -e 's/\r//g' | 321 perl -p -e 's/\r//g' |
314 } | 322 } |
316 run_tester() { | 324 run_tester() { |
317 ##!!! todo: timeout if the plugin takes too long and report as failure | 325 ##!!! todo: timeout if the plugin takes too long and report as failure |
318 dir="$1" | 326 dir="$1" |
319 log=$(logfile_for test "$dir") | 327 log=$(logfile_for test "$dir") |
320 ids=$(plugin_ids_in "$dir") | 328 ids=$(plugin_ids_in "$dir") |
329 pdir=$(plugin_dir_for "$dir") | |
321 cat /dev/null > "$log" | 330 cat /dev/null > "$log" |
322 if [ -z "$ids" ]; then | 331 if [ -z "$ids" ]; then |
323 echo | 332 echo |
324 echo "No plugins reported to test in $dir" | tee -a "$log" | 333 echo "No plugins reported to test in $dir" | tee -a "$log" |
325 echo "$dir" >> "$testfailed" | 334 echo "$dir" >> "$testfailed" |
329 for id in $ids; do | 338 for id in $ids; do |
330 extra="" | 339 extra="" |
331 if is_nondeterministic "$id"; then | 340 if is_nondeterministic "$id"; then |
332 extra="-n" | 341 extra="-n" |
333 fi | 342 fi |
334 echo "Running command: VAMP_PATH=\"$dir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log" | 343 echo "Running command: VAMP_PATH=\"$dir:$pdir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log" |
335 if ( VAMP_PATH="$dir" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then | 344 if ( VAMP_PATH="$dir:$pdir" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then |
336 echo "OK" | tee -a "$log" | 345 echo "OK" | tee -a "$log" |
337 else | 346 else |
338 echo | tee -a "$log" | 347 echo | tee -a "$log" |
339 echo "Tester failed for id $id: running again with valgrind (if available) and verbose for a report..." | tee -a "$log" | 348 echo "Tester failed for id $id: running again with valgrind (if available) and verbose for a report..." | tee -a "$log" |
340 VAMP_PATH="$dir" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log" | 349 VAMP_PATH="$dir:$pdir" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log" |
341 good=no | 350 good=no |
342 fi | 351 fi |
343 done | 352 done |
344 if [ "$good" != "yes" ]; then | 353 if [ "$good" != "yes" ]; then |
345 echo "$dir" >> "$testfailed" | 354 echo "$dir" >> "$testfailed" |
389 } | 398 } |
390 | 399 |
391 env_test_stdout() { | 400 env_test_stdout() { |
392 dir="$1" | 401 dir="$1" |
393 log=$(logfile_for envtest "$dir") | 402 log=$(logfile_for envtest "$dir") |
403 pdir=$(plugin_dir_for "$dir") | |
394 good=yes | 404 good=yes |
395 ids=$(VAMP_PATH="$dir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids); | 405 ids=$(VAMP_PATH="$dir:$pdir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids); |
396 echo | 406 echo |
397 echo "Testing for any unwanted output to stdout..." | 407 echo "Testing for any unwanted output to stdout..." |
398 for id in $ids; do | 408 for id in $ids; do |
399 case "$id" in | 409 case "$id" in |
400 vamp:*) ;; | 410 vamp:*) ;; |
408 } | 418 } |
409 | 419 |
410 env_test_cat() { | 420 env_test_cat() { |
411 dir="$1" | 421 dir="$1" |
412 log=$(logfile_for envtest "$dir") | 422 log=$(logfile_for envtest "$dir") |
423 pdir=$(plugin_dir_for "$dir") | |
424 cdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi) | |
413 good=yes | 425 good=yes |
414 first=yes | 426 first=yes |
415 echo | 427 echo |
416 echo "Testing some details of .cat files..." | 428 echo "Testing some details of .cat files..." |
417 for catfile in "$dir"/*".cat"; do | 429 for catfile in "$cdir"/*".cat"; do |
418 if [ ! -f "$catfile" ]; then | 430 if [ ! -f "$catfile" ]; then |
419 # This should only happen if the glob was not expanded at all | 431 # This should only happen if the glob was not expanded at all |
420 echo "ERROR: no .cat file found in $dir" | tee -a "$log" | 432 echo "ERROR: no .cat file found in $dir" | tee -a "$log" |
421 good=no | 433 good=no |
422 break | 434 break |
423 fi | 435 fi |
424 if [ "$first" = "yes" ]; then | 436 if [ "$first" = "yes" ]; then |
425 first=no | 437 first=no |
426 else | 438 else |
427 echo "NOTE: multiple .cat files found in $dir" | tee -a "$log" | 439 echo "NOTE: multiple .cat files found in $cdir" | tee -a "$log" |
428 fi | 440 fi |
429 done | 441 done |
430 if [ "$good" = "yes" ]; then | 442 if [ "$good" = "yes" ]; then |
431 excess=$(plugin_ids_in "$dir" | sed 's/^/vamp:/' | \ | 443 excess=$(plugin_ids_in "$dir" | sed 's/^/vamp:/' | \ |
432 cat "$dir"/*".cat" - | \ | 444 cat "$cdir"/*".cat" - | \ |
433 sed 's/::.*//' | \ | 445 sed 's/::.*//' | \ |
434 sort | \ | 446 sort | \ |
435 uniq -u) | 447 uniq -u) |
436 if [ -n "$excess" ]; then | 448 if [ -n "$excess" ]; then |
437 echo "ERROR: excess or missing definitions in .cat file? $excess" | tee -a "$log" | 449 echo "ERROR: excess or missing definitions in .cat file? $excess" | tee -a "$log" |
444 } | 456 } |
445 | 457 |
446 env_test_ttl() { | 458 env_test_ttl() { |
447 dir="$1" | 459 dir="$1" |
448 log=$(logfile_for envtest "$dir") | 460 log=$(logfile_for envtest "$dir") |
461 pdir=$(plugin_dir_for "$dir") | |
462 rdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi) | |
449 good=yes | 463 good=yes |
450 first=yes | 464 first=yes |
451 echo | 465 echo |
452 echo "Testing existence of RDF files..." | 466 echo "Testing existence of RDF files..." |
453 for ttlfile in "$dir"/*.{n3,ttl}; do | 467 for ttlfile in "$rdir"/*.{n3,ttl}; do |
454 if [ ! -f "$ttlfile" ]; then | 468 if [ ! -f "$ttlfile" ]; then |
455 # Because we have two different extensions, this isn't an | 469 # Because we have two different extensions, this isn't an |
456 # error as it is with e.g. .cat (because one or the other | 470 # error as it is with e.g. .cat (because one or the other |
457 # of .n3 and .ttl almost certainly won't exist). But if we | 471 # of .n3 and .ttl almost certainly won't exist). But if we |
458 # drop out the bottom and first is still true, then we | 472 # drop out the bottom and first is still true, then we |
459 # know neither matched. | 473 # know neither matched. |
460 : | 474 : |
461 elif [ "$first" = "yes" ]; then | 475 elif [ "$first" = "yes" ]; then |
462 first=no | 476 first=no |
463 else | 477 else |
464 echo "NOTE: multiple .ttl or .n3 files found in $dir" | tee -a "$log" | 478 echo "NOTE: multiple .ttl or .n3 files found in $rdir" | tee -a "$log" |
465 fi | 479 fi |
466 done | 480 done |
467 if [ "$first" = "yes" ]; then | 481 if [ "$first" = "yes" ]; then |
482 echo "ERROR: no .ttl or .n3 files found in $rdir" | tee -a "$log" | |
468 good=no; | 483 good=no; |
469 else | 484 else |
470 echo "GOOD: found one or more .ttl or .n3 files (we don't actually test their validity or content here though)" | tee -a "$log" | 485 echo "GOOD: found one or more .ttl or .n3 files (we don't actually test their validity or content here though)" | tee -a "$log" |
471 fi | 486 fi |
472 [ "$good" = "yes" ] | 487 [ "$good" = "yes" ] |