Browse Source

fix python 3 tests

auth
clowwindy 10 years ago
parent
commit
b409c18877
  1. 7
      tests/test.py
  2. 13
      tests/test_latency.py

7
tests/test.py

@ -22,11 +22,6 @@ elif sys.argv[-2] == '-c':
else: else:
raise Exception('usage: test.py -c server_conf [client_conf]') raise Exception('usage: test.py -c server_conf [client_conf]')
if 'salsa20' in sys.argv[-1]:
from shadowsocks.crypto import salsa20_ctr
salsa20_ctr.test()
print('encryption test passed')
p1 = Popen(['python', 'shadowsocks/server.py', '-c', server_config], p1 = Popen(['python', 'shadowsocks/server.py', '-c', server_config],
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
p2 = Popen(['python', 'shadowsocks/local.py', '-c', client_config], p2 = Popen(['python', 'shadowsocks/local.py', '-c', client_config],
@ -44,6 +39,8 @@ try:
for fd in r: for fd in r:
line = fd.readline() line = fd.readline()
if bytes != str:
line = str(line, 'utf8')
sys.stdout.write(line) sys.stdout.write(line)
if line.find('starting local') >= 0: if line.find('starting local') >= 0:
local_ready = True local_ready = True

13
tests/test_latency.py

@ -1,13 +0,0 @@
#!/usr/bin/python
import sys
import time
if __name__ == '__main__':
before = time.time()
for line in sys.stdin:
if 'HTTP/1.1 ' in line:
diff = time.time() - before
print 'headline %dms' % (diff * 1000)
Loading…
Cancel
Save