From 1e7b95c25ce26eafe72c551bab111eb3761475a3 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 26 Apr 2022 21:04:45 -0400 Subject: [PATCH] test: gocr by_word --- tests/gocr/by_word/Makefile | 10 ++++++- tests/gocr/by_word/run.sh | 10 +++---- tests/gocr/by_word/spec.json | 54 ++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/tests/gocr/by_word/Makefile b/tests/gocr/by_word/Makefile index 7704675..747cf3a 100644 --- a/tests/gocr/by_word/Makefile +++ b/tests/gocr/by_word/Makefile @@ -17,5 +17,13 @@ client-10: shuf -n10 /usr/share/dict/american-english > tmp/10_words.txt pango-view --font=mono -qo tmp/10_words.png tmp/10_words.txt pngtopnm tmp/10_words.png > tmp/10_words.pnm - curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@tmp/10_words.pnm" "${HOSTNAME}:10000" + curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@tmp/10_words.pnm" "${HOSTNAME}:10000/gocr_10_words" + rm -rf tmp + +client-100: + mkdir -p tmp + shuf -n100 /usr/share/dict/american-english > tmp/100_words.txt + pango-view --font=mono -qo tmp/100_words.png tmp/100_words.txt + pngtopnm tmp/100_words.png > tmp/100_words.pnm + curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary "@tmp/100_words.pnm" "${HOSTNAME}:10000/gocr_100_words" rm -rf tmp diff --git a/tests/gocr/by_word/run.sh b/tests/gocr/by_word/run.sh index 87cdf4d..ebb06b9 100755 --- a/tests/gocr/by_word/run.sh +++ b/tests/gocr/by_word/run.sh @@ -34,10 +34,10 @@ experiment_client() { # Write Headers to CSV files - local -Ar word_count_to_port=( - ["1_words"]=10000 - ["10_words"]=10001 - ["100_words"]=10002 + local -Ar word_count_to_path=( + ["1_words"]=/gocr_1_word + ["10_words"]=/gocr_10_words + ["100_words"]=/gocr_100_words ) local words @@ -50,7 +50,7 @@ experiment_client() { pango-view --font=mono -qo "$word_count_file.png" -t "$words" || exit 1 pngtopnm "$word_count_file.png" > "$word_count_file.pnm" || exit 1 - result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @"$word_count_file.pnm" "$hostname:${word_count_to_port[$word_count_file]}" --silent -w "%{stderr}%{time_total}\n" 2>> "$results_directory/${word_count_file}_time.txt") + result=$(curl -H 'Expect:' -H "Content-Type: text/plain" --data-binary @"$word_count_file.pnm" "$hostname:10000${word_count_to_path[$word_count_file]}" --silent -w "%{stderr}%{time_total}\n" 2>> "$results_directory/${word_count_file}_time.txt") # If the OCR does not produce a guess, fail [[ -z "$result" ]] && exit 1 diff --git a/tests/gocr/by_word/spec.json b/tests/gocr/by_word/spec.json index b24b65b..f5fc63e 100644 --- a/tests/gocr/by_word/spec.json +++ b/tests/gocr/by_word/spec.json @@ -1,32 +1,32 @@ [ { - "name": "gocr_1_word", - "path": "gocr.wasm.so", + "name": "gwu", "port": 10000, - "expected-execution-us": 5000, - "relative-deadline-us": 36000, - "http-req-size": 5335057, - "http-resp-size": 5335057, - "http-resp-content-type": "text/plain" - }, - { - "name": "gocr_10_words", - "path": "gocr.wasm.so", - "port": 10001, - "expected-execution-us": 5000, - "relative-deadline-us": 36000, - "http-req-size": 5335057, - "http-resp-size": 5335057, - "http-resp-content-type": "text/plain" - }, - { - "name": "gocr_100_words", - "path": "gocr.wasm.so", - "port": 10002, - "expected-execution-us": 5000, - "relative-deadline-us": 36000, - "http-req-size": 5335057, - "http-resp-size": 5335057, - "http-resp-content-type": "text/plain" + "routes": [ + { + "route": "/gocr_1_word", + "path": "gocr.wasm.so", + "expected-execution-us": 5000, + "relative-deadline-us": 36000, + "http-resp-size": 5335057, + "http-resp-content-type": "text/plain" + }, + { + "route": "/gocr_10_words", + "path": "gocr.wasm.so", + "expected-execution-us": 5000, + "relative-deadline-us": 36000, + "http-resp-size": 5335057, + "http-resp-content-type": "text/plain" + }, + { + "route": "/gocr_100_words", + "path": "gocr.wasm.so", + "expected-execution-us": 5000, + "relative-deadline-us": 36000, + "http-resp-size": 5335057, + "http-resp-content-type": "text/plain" + } + ] } ]