aboutsummaryrefslogtreecommitdiffstats
path: root/test/autobahn_SUITE_data/test.py
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-20 22:20:54 +0200
committerLoïc Hoguin <[email protected]>2014-04-20 22:20:54 +0200
commit74512fc84c1e20050f69b3a53d2fc5ef4edbe9dd (patch)
tree4b153ebe6a7cc25872def6e6f06917a3057b3ff5 /test/autobahn_SUITE_data/test.py
parent806cde9ace3bd67988e07885c9899ead0a9425d5 (diff)
downloadcowboy-74512fc84c1e20050f69b3a53d2fc5ef4edbe9dd.tar.gz
cowboy-74512fc84c1e20050f69b3a53d2fc5ef4edbe9dd.tar.bz2
cowboy-74512fc84c1e20050f69b3a53d2fc5ef4edbe9dd.zip
Enable Autobahn Test Suite by default
Includes a variety of small changes that are a first step to improving the test system heavily.
Diffstat (limited to 'test/autobahn_SUITE_data/test.py')
-rwxr-xr-xtest/autobahn_SUITE_data/test.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/test/autobahn_SUITE_data/test.py b/test/autobahn_SUITE_data/test.py
deleted file mode 100755
index f142683..0000000
--- a/test/autobahn_SUITE_data/test.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-import os
-import os.path
-import sys
-import subprocess
-
-
-AB_TESTS_ENV = os.getenv("AB_TESTS_ENV")
-AB_TESTS_PRIV = os.getenv("AB_TESTS_PRIV")
-
-VIRTUALENV_URL = 'https://raw.github.com/pypa/virtualenv/master/virtualenv.py'
-VIRTUALENV_BIN = os.path.join(AB_TESTS_ENV, "virtualenv.py")
-INSTALL_BIN = os.path.join(AB_TESTS_ENV, "bin", "easy_install")
-
-
-def activate_env(env):
- """
- See 'Using Virtualenv without bin/python' at http://www.virtualenv.org
- """
- activate_this = os.path.join(env, 'bin', 'activate_this.py')
- exec(compile(open(activate_this).read(), activate_this, 'exec'),
- dict(__file__=activate_this))
-
-def install_env(env):
- """
- Install a new virtualenv at a path and also install the Autobahn package.
- """
- os.makedirs(env) if not os.path.isdir(env) else None
- subprocess.check_call(["curl", "-sS", VIRTUALENV_URL, "-o", VIRTUALENV_BIN])
- subprocess.check_call(["python", VIRTUALENV_BIN, env])
- activate_env(env)
- subprocess.check_call([INSTALL_BIN, "http://pypi.python.org/packages/2.7/a/autobahntestsuite/autobahntestsuite-0.5.3-py2.7.egg"])
-
-def client_config():
- """
- See comment on SUPPORTED_SPEC_VERSIONS in Autobahn/.../websocket.py
- """
- base = {
- 'options': {'failByDrop': False},
- 'enable-ssl': False,
- 'servers': [{
- 'agent': 'Cowboy',
- 'url': 'ws://localhost:33080/echo',
- 'options': {'version': 18} # RFC6455
- }],
- 'cases': ['*'],
- 'exclude-cases': [] }
- return base
-
-def run_test(env, config):
- activate_env(env)
- from twisted.python import log
- from twisted.internet import reactor
- from autobahntestsuite.fuzzing import FuzzingClientFactory
- os.chdir(AB_TESTS_PRIV)
- log.startLogging(sys.stdout)
- fuzzer = FuzzingClientFactory(config)
- return reactor.run()
-
-
-def main():
- cmd = sys.argv[1]
- if cmd == 'setup':
- install_env(AB_TESTS_ENV)
- print('AB-TESTS-SETUP-OK')
- elif cmd == 'test':
- run_test(AB_TESTS_ENV, client_config())
- print('AB-TESTS-TEST-OK')
- else:
- return 1
-
-if __name__ == '__main__':
- main()