tests: rely on Autobahn Suite usage from docker

See https://github.com/snapview/tokio-tungstenite/pull/165 for more
details.
pull/200/head
Daniel Abramov 3 years ago
parent 550cc49cc6
commit 485d04b099
  1. 5
      .travis.yml
  2. 0
      autobahn/expected-results.json
  3. 3637
      autobahn/server-results.json
  4. 18
      scripts/autobahn-client.sh
  5. 17
      scripts/autobahn-server.sh

@ -2,9 +2,8 @@ language: rust
rust: rust:
- stable - stable
install: services:
- sudo apt-get install python-unittest2 - docker
- sudo pip install ghp-import urllib3[secure] autobahntestsuite
before_script: before_script:
- export PATH="$PATH:$HOME/.cargo/bin" - export PATH="$PATH:$HOME/.cargo/bin"

File diff suppressed because it is too large Load Diff

@ -6,27 +6,31 @@ SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}")
SOURCE_DIR=$(dirname "$SOURCE_DIR") SOURCE_DIR=$(dirname "$SOURCE_DIR")
cd "${SOURCE_DIR}/.." cd "${SOURCE_DIR}/.."
CONTAINER_NAME=fuzzingserver
function cleanup() { function cleanup() {
kill -9 ${FUZZINGSERVER_PID} docker container stop "${CONTAINER_NAME}"
} }
trap cleanup TERM EXIT trap cleanup TERM EXIT
function test_diff() { function test_diff() {
if ! diff -q \ if ! diff -q \
<(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/client-results.json') \ <(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/expected-results.json') \
<(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/client/index.json') <(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/client/index.json')
then then
echo 'Difference in results, either this is a regression or' \ echo 'Difference in results, either this is a regression or' \
'one should update autobahn/client-results.json with the new results.' \ 'one should update autobahn/expected-results.json with the new results.' \
'The results are:'
exit 64 exit 64
fi fi
} }
cargo build --release --example autobahn-client docker run -d --rm \
-v "${PWD}/autobahn:/autobahn" \
-p 9001:9001 \
--init \
--name "${CONTAINER_NAME}" \
crossbario/autobahn-testsuite \
wstest -m fuzzingserver -s 'autobahn/fuzzingserver.json'
wstest -m fuzzingserver -s 'autobahn/fuzzingserver.json' & FUZZINGSERVER_PID=$!
sleep 3 sleep 3
echo "Server PID: ${FUZZINGSERVER_PID}"
cargo run --release --example autobahn-client cargo run --release --example autobahn-client
test_diff test_diff

@ -5,7 +5,6 @@ set -x
SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}") SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}")
SOURCE_DIR=$(dirname "$SOURCE_DIR") SOURCE_DIR=$(dirname "$SOURCE_DIR")
cd "${SOURCE_DIR}/.." cd "${SOURCE_DIR}/.."
WSSERVER_PID=
function cleanup() { function cleanup() {
kill -9 ${WSSERVER_PID} kill -9 ${WSSERVER_PID}
@ -14,18 +13,22 @@ trap cleanup TERM EXIT
function test_diff() { function test_diff() {
if ! diff -q \ if ! diff -q \
<(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/client-results.json') \ <(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/expected-results.json') \
<(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/server/index.json') <(jq -S 'del(."Tungstenite" | .. | .duration?)' 'autobahn/server/index.json')
then then
echo Difference in results, either this is a regression or \ echo 'Difference in results, either this is a regression or' \
one should update autobahn/server-results.json with the new results. 'one should update autobahn/expected-results.json with the new results.' \
exit 64 exit 64
fi fi
} }
cargo build --release --example autobahn-server
cargo run --release --example autobahn-server & WSSERVER_PID=$! cargo run --release --example autobahn-server & WSSERVER_PID=$!
echo "Server PID: ${WSSERVER_PID}"
sleep 3 sleep 3
wstest -m fuzzingclient -s 'autobahn/fuzzingclient.json'
docker run --rm \
-v "${PWD}/autobahn:/autobahn" \
--network host \
crossbario/autobahn-testsuite \
wstest -m fuzzingclient -s 'autobahn/fuzzingclient.json'
test_diff test_diff

Loading…
Cancel
Save