changeset 143:a9be6f1e680d

Don't try to validate if schema dir not found (avoiding lengthy errors)
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 18 Jan 2017 14:19:12 +0000
parents 9768b5ca710a
children 654e85cc3ba1
files test/test-server.sh
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/test-server.sh	Wed Jan 18 14:13:21 2017 +0000
+++ b/test/test-server.sh	Wed Jan 18 14:19:12 2017 +0000
@@ -6,6 +6,10 @@
 vampsdkdir=../vamp-plugin-sdk
 schemadir="$piperdir"/json/schema
 
+if [ ! -d "$schemadir" ]; then
+    echo "WARNING: schema directory $schemadir not found, won't be validating JSON schema" 1>&2
+fi
+
 tmpdir=$(mktemp -d)
 
 if [ ! -d "$tmpdir" ]; then
@@ -25,9 +29,13 @@
 validate() {
     local file="$1"
     local schemaname="$2"
-    jsonschema -i "$file" "$schemadir/$schemaname.json" 1>&2 && \
-        echo "validated $schemaname" 1>&2 || \
-        echo "failed to validate $schemaname" 1>&2
+    if [ -d "$schemadir" ]; then
+        jsonschema -i "$file" "$schemadir/$schemaname.json" 1>&2 && \
+            echo "validated $schemaname" 1>&2 || \
+            echo "failed to validate $schemaname" 1>&2
+    else
+        echo "schema directory $schemadir not found, skipping validation" 1>&2
+    fi
 }
 
 validate_request() {