[Spice-devel] [PATCH spice-server 23/23] ci: Add test for websockets

Frediano Ziglio fziglio at redhat.com
Tue Jun 25 16:11:47 UTC 2019


---
 .gitlab-ci.yml                     | 20 ++++++++++++++++++++
 server/tests/autobahn-check-report | 18 ++++++++++++++++++
 server/tests/fuzzingclient.json    | 11 +++++++++++
 3 files changed, 49 insertions(+)
 create mode 100755 server/tests/autobahn-check-report
 create mode 100644 server/tests/fuzzingclient.json

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6e5204af7..b303d4656 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -136,3 +136,23 @@ makecheck-windows:
   - mingw64-configure --disable-celt051
   - mingw64-make
   - mingw64-make LOG_COMPILE=wine -C server check || (cat server/tests/test-suite.log && exit 1)
+
+websocket-autobahn:
+  before_script:
+  - apt-get update || true
+  - apt-get install -y python-six python-pyparsing libopus-dev libssl-dev libglib2.0-dev
+  - git clone ${CI_REPOSITORY_URL/spice.git/spice-protocol.git}
+  - (cd spice-protocol && ./autogen.sh --prefix=/usr && make install)
+  image: crossbario/autobahn-testsuite
+  script:
+  - ./autogen.sh
+  - make -j4
+  - ./server/tests/test-websocket & pid=$!
+  - wstest -m fuzzingclient -s server/tests/fuzzingclient.json
+  - kill $pid
+  - server/tests/autobahn-check-report reports/servers/index.json
+  - rm -rf reports/servers
+  - ./server/tests/test-websocket -n & pid=$!
+  - wstest -m fuzzingclient -s server/tests/fuzzingclient.json
+  - kill $pid
+  - server/tests/autobahn-check-report reports/servers/index.json
diff --git a/server/tests/autobahn-check-report b/server/tests/autobahn-check-report
new file mode 100755
index 000000000..9e29128c7
--- /dev/null
+++ b/server/tests/autobahn-check-report
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+import sys
+import json
+
+num_tests = 0
+for server in json.load(open(sys.argv[1])).values():
+  for test, result in server.items():
+    is_test = 0
+    for k, v in result.items():
+      if k[:8].lower() != 'behavior':
+        continue
+      is_test = 1
+      if v != 'OK' and v != 'INFORMATIONAL':
+        raise Exception('Invalid %s %s for test %s' % (k, v, test))
+    num_tests += is_test
+if num_tests < 100:
+  raise Exception('Too few tests done %s' % num_tests)
+print('Output report is fine')
diff --git a/server/tests/fuzzingclient.json b/server/tests/fuzzingclient.json
new file mode 100644
index 000000000..8bc1b718d
--- /dev/null
+++ b/server/tests/fuzzingclient.json
@@ -0,0 +1,11 @@
+{
+   "outdir": "./reports/servers",
+   "servers": [
+      {
+         "url": "ws://127.0.0.1:7777"
+      }
+   ],
+   "cases": ["*"],
+   "exclude-cases": ["6.*","12.*","13.*"],
+   "exclude-agent-cases": {}
+}
-- 
2.20.1



More information about the Spice-devel mailing list