add coverage
This commit is contained in:
parent
b4ce4b7f48
commit
55630f5a7e
2 changed files with 26 additions and 21 deletions
35
.travis.yml
35
.travis.yml
|
@ -11,26 +11,27 @@ cache:
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils
|
- sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils
|
||||||
- pip install m2crypto salsa20 pep8 pyflakes nose
|
- pip install m2crypto salsa20 pep8 pyflakes nose coverage
|
||||||
- sudo tests/socksify/install.sh
|
- sudo tests/socksify/install.sh
|
||||||
- sudo tests/libsodium/install.sh
|
- sudo tests/libsodium/install.sh
|
||||||
script:
|
script:
|
||||||
- pep8 .
|
- pep8 .
|
||||||
- pyflakes .
|
- pyflakes .
|
||||||
- python tests/nose_plugin.py -v
|
- coverage run tests/nose_plugin.py -v
|
||||||
- python setup.py sdist
|
- python setup.py sdist
|
||||||
- python tests/test.py -c tests/aes.json
|
- python tests/test.py --with-coverage -c tests/aes.json
|
||||||
- python tests/test.py -c tests/aes-ctr.json
|
- python tests/test.py --with-coverage -c tests/aes-ctr.json
|
||||||
- python tests/test.py -c tests/aes-cfb1.json
|
- python tests/test.py --with-coverage -c tests/aes-cfb1.json
|
||||||
- python tests/test.py -c tests/aes-cfb8.json
|
- python tests/test.py --with-coverage -c tests/aes-cfb8.json
|
||||||
- python tests/test.py -c tests/rc4-md5.json
|
- python tests/test.py --with-coverage -c tests/rc4-md5.json
|
||||||
- python tests/test.py -c tests/salsa20.json
|
- python tests/test.py --with-coverage -c tests/salsa20.json
|
||||||
- python tests/test.py -c tests/chacha20.json
|
- python tests/test.py --with-coverage -c tests/chacha20.json
|
||||||
- python tests/test.py -c tests/salsa20-ctr.json
|
- python tests/test.py --with-coverage -c tests/salsa20-ctr.json
|
||||||
- python tests/test.py -c tests/table.json
|
- python tests/test.py --with-coverage -c tests/table.json
|
||||||
- python tests/test.py -c tests/server-multi-ports.json
|
- python tests/test.py --with-coverage -c tests/server-multi-ports.json
|
||||||
- python tests/test.py -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json
|
- python tests/test.py --with-coverage -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json
|
||||||
- python tests/test.py -c tests/workers.json
|
- python tests/test.py --with-coverage -c tests/workers.json
|
||||||
- python tests/test.py -s tests/ipv6.json -c tests/ipv6-client-side.json
|
- python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json
|
||||||
- python tests/test.py -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081"
|
- python tests/test.py --with-coverage -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081"
|
||||||
- python tests/test.py -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081"
|
- python tests/test.py --with-coverage -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081"
|
||||||
|
- coverage report --include=shadowsocks/*
|
||||||
|
|
|
@ -32,18 +32,22 @@ import time
|
||||||
import argparse
|
import argparse
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
python = 'python'
|
python = ['python']
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='test Shadowsocks')
|
parser = argparse.ArgumentParser(description='test Shadowsocks')
|
||||||
parser.add_argument('-c', '--client-conf', type=str, default=None)
|
parser.add_argument('-c', '--client-conf', type=str, default=None)
|
||||||
parser.add_argument('-s', '--server-conf', type=str, default=None)
|
parser.add_argument('-s', '--server-conf', type=str, default=None)
|
||||||
parser.add_argument('-a', '--client-args', type=str, default=None)
|
parser.add_argument('-a', '--client-args', type=str, default=None)
|
||||||
parser.add_argument('-b', '--server-args', type=str, default=None)
|
parser.add_argument('-b', '--server-args', type=str, default=None)
|
||||||
|
parser.add_argument('--with-coverage', action='store_true', default=None)
|
||||||
|
|
||||||
config = parser.parse_args()
|
config = parser.parse_args()
|
||||||
|
|
||||||
client_args = [python, 'shadowsocks/local.py', '-v']
|
if config.with_coverage:
|
||||||
server_args = [python, 'shadowsocks/server.py', '-v']
|
python = ['coverage', 'run', '-a']
|
||||||
|
|
||||||
|
client_args = python + ['shadowsocks/local.py', '-v']
|
||||||
|
server_args = python + ['shadowsocks/server.py', '-v']
|
||||||
|
|
||||||
if config.client_conf:
|
if config.client_conf:
|
||||||
client_args.extend(['-c', config.client_conf])
|
client_args.extend(['-c', config.client_conf])
|
||||||
|
@ -134,6 +138,6 @@ try:
|
||||||
finally:
|
finally:
|
||||||
for p in [p1, p2]:
|
for p in [p1, p2]:
|
||||||
try:
|
try:
|
||||||
os.kill(p.pid, signal.SIGTERM)
|
os.kill(p.pid, signal.SIGQUIT)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue