travis: add automated autobahn tests

Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
This commit is contained in:
Alexey Galakhov 2019-05-17 01:30:41 +02:00
parent 06308b1b3f
commit 758c522b31
8 changed files with 7360 additions and 1 deletions

View File

@ -1 +1,13 @@
language: rust
before_script:
- export PATH="$PATH:$HOME/.cargo/bin"
script:
- cargo test --release
after_success:
- sudo apt-get install python-unittest2
- sudo pip install ghp-import urllib3[secure] autobahntestsuite
- echo "Running Autobahn TestSuite for client" && ./scripts/autobahn-client.sh
- echo "Running Autobahn TestSuite for server" && ./scripts/autobahn-server.sh

3623
autobahn/client-results.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
{
"outdir": "./autobahn/server",
"servers": [
{
"agent": "rust-websocket",
"url": "ws://127.0.0.1:9002"
}
],
"cases": ["*"],
"exclude-cases": [],
"exclude-agent-cases": {}
}

View File

@ -0,0 +1,7 @@
{
"url": "ws://127.0.0.1:9001",
"outdir": "./autobahn/client",
"cases": ["*"],
"exclude-cases": [],
"exclude-agent-cases": {}
}

3637
autobahn/server-results.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ fn handle_client(stream: TcpStream) -> Result<()> {
fn main() {
env_logger::init();
let server = TcpListener::bind("127.0.0.1:9001").unwrap();
let server = TcpListener::bind("127.0.0.1:9002").unwrap();
for stream in server.incoming() {
spawn(move || {

34
scripts/autobahn-client.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Author michael <themichaeleden@gmail.com>
set -euo pipefail
set -x
SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}")
SOURCE_DIR=$(dirname "$SOURCE_DIR")
cd "${SOURCE_DIR}/.."
function cleanup() {
kill -9 ${FUZZINGSERVER_PID}
}
trap cleanup TERM EXIT
function test_diff() {
DIFF=$(diff \
<(jq -S 'del(."rust-websocket" | .. | .duration?)' 'autobahn/client-results.json') \
<(jq -S 'del(."rust-websocket" | .. | .duration?)' 'autobahn/client/index.json') )
if [[ $DIFF ]]; then
echo 'Difference in results, either this is a regression or' \
'one should update autobahn/client-results.json with the new results.' \
'The results are:'
echo $DIFF
exit 64
fi
}
cargo build --release --example autobahn-client
wstest -m fuzzingserver -s 'autobahn/fuzzingserver.json' & FUZZINGSERVER_PID=$!
sleep 3
echo "Server PID: ${WSSERVER_PID}"
cargo run --release --example autobahn-client
test_diff

34
scripts/autobahn-server.sh Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Author michael <themichaeleden@gmail.com>
set -euo pipefail
set -x
SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}")
SOURCE_DIR=$(dirname "$SOURCE_DIR")
cd "${SOURCE_DIR}/.."
WSSERVER_PID=
function cleanup() {
kill -9 ${WSSERVER_PID}
}
trap cleanup TERM EXIT
function test_diff() {
DIFF=$(diff \
<(jq -S 'del(."rust-websocket" | .. | .duration?)' 'autobahn/client-results.json') \
<(jq -S 'del(."rust-websocket" | .. | .duration?)' 'autobahn/server/index.json') )
if [[ $DIFF ]]; then
echo Difference in results, either this is a regression or \
one should update autobahn/server-results.json with the new results. \
The results are:
echo $DIFF
exit 64
fi
}
cargo build --release --example autobahn-server
./target/debug/examples/autobahn-server & WSSERVER_PID=$!
echo "Server PID: ${WSSERVER_PID}"
sleep 3
wstest -m fuzzingclient -s 'autobahn/fuzzingclient.json'
test_diff