From f0b0f6edffcfff1e82cbde49063d1a3c5e480da7 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sat, 20 Sep 2014 18:40:35 +0800 Subject: [PATCH] do not mix config of client and server for server-multi-passwd --- .travis.yml | 2 +- tests/server-multi-passwd-client-side.json | 8 ++++++++ tests/server-multi-passwd.json | 2 -- tests/test.py | 17 +++++++++++++---- 4 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 tests/server-multi-passwd-client-side.json diff --git a/.travis.yml b/.travis.yml index 70a3cf9..e36c641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,6 @@ script: - python tests/test.py -c tests/rc4-md5.json - python tests/test.py -c tests/salsa20.json - python tests/test.py -c tests/server-multi-ports.json - - python tests/test.py -c tests/server-multi-passwd.json + - python tests/test.py -c tests/server-multi-passwd.json tests/server-multi-passwd-client-side.json - python tests/test.py -c tests/server-multi-passwd-table.json - python tests/test.py -c tests/workers.json diff --git a/tests/server-multi-passwd-client-side.json b/tests/server-multi-passwd-client-side.json new file mode 100644 index 0000000..c822c98 --- /dev/null +++ b/tests/server-multi-passwd-client-side.json @@ -0,0 +1,8 @@ +{ + "server": "127.0.0.1", + "server_port": "8385", + "local_port": 1081, + "password": "foobar5", + "timeout": 60, + "method": "aes-256-cfb" +} diff --git a/tests/server-multi-passwd.json b/tests/server-multi-passwd.json index eff5ed8..b1407f0 100644 --- a/tests/server-multi-passwd.json +++ b/tests/server-multi-passwd.json @@ -1,8 +1,6 @@ { "server": "127.0.0.1", - "server_port": 8384, "local_port": 1081, - "password": "foobar4", "port_password": { "8381": "foobar1", "8382": "foobar2", diff --git a/tests/test.py b/tests/test.py index 632312f..83c2332 100755 --- a/tests/test.py +++ b/tests/test.py @@ -10,15 +10,24 @@ from subprocess import Popen, PIPE sys.path.insert(0, './') +if sys.argv[-3] == '-c': + client_config = sys.argv[-1] + server_config = sys.argv[-2] +elif sys.argv[-2] == '-c': + client_config = sys.argv[-1] + server_config = sys.argv[-1] +else: + 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', sys.argv[-1]], stdin=PIPE, - stdout=PIPE, stderr=PIPE, close_fds=True) -p2 = Popen(['python', 'shadowsocks/local.py', '-c', sys.argv[-1]], stdin=PIPE, - stdout=PIPE, stderr=PIPE, close_fds=True) +p1 = Popen(['python', 'shadowsocks/server.py', '-c', server_config], + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) +p2 = Popen(['python', 'shadowsocks/local.py', '-c', client_config], + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) p3 = None try: