diff 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
line wrap: on
line diff
--- a/SCRIPTS/process.sh	Thu Oct 30 17:39:24 2014 +0000
+++ b/SCRIPTS/process.sh	Mon Nov 17 13:00:08 2014 +0000
@@ -224,6 +224,13 @@
     fi
 }
 
+plugin_dir_for() {
+    dir="$1"
+    if grep -q "^$dir: " METADATA/plugindir.txt ; then
+	echo "$dir"/$(grep "^$dir: " METADATA/plugindir.txt | head -1 | sed 's/^[^:]*: //')
+    fi
+}
+
 logfile_for() {
     activity="$1"
     dir="$2"
@@ -304,9 +311,10 @@
 
 plugin_ids_in() {
     dir="$1"
+    pdir=$(plugin_dir_for "$dir")
     # can't use sed to remove \r from DOS line endings -- BSD and GNU
     # vary in how they interpret \r escape -- so we use perl for that...
-    VAMP_PATH="$dir" $hostwrapper \
+    VAMP_PATH="$dir:$pdir" $hostwrapper \
 	vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | \
 	grep '^vamp:' | \
 	sed 's/^vamp://' | \
@@ -318,6 +326,7 @@
     dir="$1"
     log=$(logfile_for test "$dir")
     ids=$(plugin_ids_in "$dir")
+    pdir=$(plugin_dir_for "$dir")
     cat /dev/null > "$log"
     if [ -z "$ids" ]; then
 	echo 
@@ -331,13 +340,13 @@
 	if is_nondeterministic "$id"; then
 	    extra="-n"
 	fi
-	echo "Running command: VAMP_PATH=\"$dir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log"
-	if ( VAMP_PATH="$dir" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then
+	echo "Running command: VAMP_PATH=\"$dir:$pdir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log"
+	if ( VAMP_PATH="$dir:$pdir" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then
 	    echo "OK" | tee -a "$log"
 	else
 	    echo | tee -a "$log"
 	    echo "Tester failed for id $id: running again with valgrind (if available) and verbose for a report..." | tee -a "$log"
-	    VAMP_PATH="$dir" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log"
+	    VAMP_PATH="$dir:$pdir" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log"
 	    good=no
 	fi
     done
@@ -391,8 +400,9 @@
 env_test_stdout() {
     dir="$1"
     log=$(logfile_for envtest "$dir")
+    pdir=$(plugin_dir_for "$dir")
     good=yes
-    ids=$(VAMP_PATH="$dir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids);
+    ids=$(VAMP_PATH="$dir:$pdir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids);
     echo 
     echo "Testing for any unwanted output to stdout..."
     for id in $ids; do
@@ -410,11 +420,13 @@
 env_test_cat() {
     dir="$1"
     log=$(logfile_for envtest "$dir")
+    pdir=$(plugin_dir_for "$dir")
+    cdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi)
     good=yes
     first=yes
     echo 
     echo "Testing some details of .cat files..."
-    for catfile in "$dir"/*".cat"; do
+    for catfile in "$cdir"/*".cat"; do
 	if [ ! -f "$catfile" ]; then
 	    # This should only happen if the glob was not expanded at all
 	    echo "ERROR: no .cat file found in $dir" | tee -a "$log"
@@ -424,12 +436,12 @@
 	if [ "$first" = "yes" ]; then
 	    first=no
 	else
-	    echo "NOTE: multiple .cat files found in $dir" | tee -a "$log"
+	    echo "NOTE: multiple .cat files found in $cdir" | tee -a "$log"
 	fi
     done
     if [ "$good" = "yes" ]; then
 	excess=$(plugin_ids_in "$dir" | sed 's/^/vamp:/' | \
-	    cat "$dir"/*".cat" - | \
+	    cat "$cdir"/*".cat" - | \
 	    sed 's/::.*//' | \
             sort | \
             uniq -u)
@@ -446,11 +458,13 @@
 env_test_ttl() {
     dir="$1"
     log=$(logfile_for envtest "$dir")
+    pdir=$(plugin_dir_for "$dir")
+    rdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi)
     good=yes
     first=yes
     echo 
     echo "Testing existence of RDF files..."
-    for ttlfile in "$dir"/*.{n3,ttl}; do
+    for ttlfile in "$rdir"/*.{n3,ttl}; do
 	if [ ! -f "$ttlfile" ]; then
 	    # Because we have two different extensions, this isn't an
 	    # error as it is with e.g. .cat (because one or the other
@@ -461,10 +475,11 @@
 	elif [ "$first" = "yes" ]; then
 	    first=no
 	else
-	    echo "NOTE: multiple .ttl or .n3 files found in $dir" | tee -a "$log"
+	    echo "NOTE: multiple .ttl or .n3 files found in $rdir" | tee -a "$log"
 	fi
     done
-    if [ "$first" = "yes" ]; then 
+    if [ "$first" = "yes" ]; then
+	echo "ERROR: no .ttl or .n3 files found in $rdir" | tee -a "$log"
 	good=no; 
     else
 	echo "GOOD: found one or more .ttl or .n3 files (we don't actually test their validity or content here though)" | tee -a "$log"