Mercurial > hg > piper-cpp
diff test/test-vampipe-server.sh @ 69:91fda9470ee2
Merge from branch jsonrpc
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 06 Oct 2016 14:33:12 +0100 |
parents | a5ba837bca28 |
children | 7bfc07576830 |
line wrap: on
line diff
--- a/test/test-vampipe-server.sh Tue Sep 27 15:04:59 2016 +0100 +++ b/test/test-vampipe-server.sh Thu Oct 06 14:33:12 2016 +0100 @@ -19,28 +19,13 @@ validate_request() { local json="$1" echo "$json" > "$reqfile" - validate "$reqfile" "request" - type=$(grep '"type":' "$reqfile" | sed 's/^.*"type": *"\([^"]*\)".*$/\1/') - if [ "$type" == "configure" ]; then type=configuration; fi - if [ "$type" != "list" ]; then - echo "$json" | - sed 's/^.*"content"://' | - sed 's/}}$/}/' > "$reqfile" - validate "$reqfile" "${type}request" - fi + validate "$reqfile" "rpcrequest" } validate_response() { local json="$1" echo "$json" > "$respfile" - validate "$respfile" "response" - type=$(grep '"type":' "$respfile" | sed 's/^.*"type": "\([^"]*\)".*$/\1/') - if [ "$type" == "configure" ]; then type=configuration; fi - echo "$json" | - sed 's/^.*"content"://' | - sed 's/, "error.*$//' | - sed 's/, "success.*$//' > "$respfile" - validate "$respfile" "${type}response" + validate "$respfile" "rpcresponse" } ( while read request ; do @@ -54,9 +39,9 @@ validate_response "$response" done ) <<EOF -{"type":"list"} -{"type":"load","content": {"pluginKey":"vamp-example-plugins:percussiononsets","inputSampleRate":44100,"adapterFlags":["AdaptInputDomain","AdaptBufferSize"]}} -{"type":"configure","content":{"pluginHandle":1,"configuration":{"blockSize": 8, "channelCount": 1, "parameterValues": {"sensitivity": 40, "threshold": 3}, "stepSize": 8}}} -{"type":"process","content": {"pluginHandle": 1, "processInput": { "timestamp": {"s": 0, "n": 0}, "inputBuffers": [ [1,2,3,4,5,6,7,8] ]}}} -{"type":"finish","content": {"pluginHandle": 1}} +{"method":"list"} +{"method":"load","params": {"key":"vamp-example-plugins:percussiononsets","inputSampleRate":44100,"adapterFlags":["AdaptInputDomain","AdaptBufferSize"]}} +{"method":"configure","params":{"handle":1,"configuration":{"blockSize": 8, "channelCount": 1, "parameterValues": {"sensitivity": 40, "threshold": 3}, "stepSize": 8}}} +{"method":"process","params": {"handle": 1, "processInput": { "timestamp": {"s": 0, "n": 0}, "inputBuffers": [ [1,2,3,4,5,6,7,8] ]}}} +{"method":"finish","params": {"handle": 1}} EOF