2014-12-24 10:02:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. tests/assert.sh
|
|
|
|
|
2016-01-11 15:57:18 +00:00
|
|
|
PYTHON="coverage run -a"
|
2014-12-24 10:02:14 +00:00
|
|
|
LOCAL="$PYTHON shadowsocks/local.py"
|
|
|
|
SERVER="$PYTHON shadowsocks/server.py"
|
|
|
|
|
2015-02-09 06:43:11 +00:00
|
|
|
assert "$LOCAL --version 2>&1 | grep Shadowsocks | awk -F\" \" '{print \$1}'" "Shadowsocks"
|
|
|
|
assert "$SERVER --version 2>&1 | grep Shadowsocks | awk -F\" \" '{print \$1}'" "Shadowsocks"
|
|
|
|
|
2014-12-24 10:02:14 +00:00
|
|
|
assert "$LOCAL 2>&1 | grep ERROR" "ERROR: config not specified"
|
|
|
|
assert "$LOCAL 2>&1 | grep usage | cut -d: -f1" "usage"
|
|
|
|
|
|
|
|
assert "$SERVER 2>&1 | grep ERROR" "ERROR: config not specified"
|
|
|
|
assert "$SERVER 2>&1 | grep usage | cut -d: -f1" "usage"
|
|
|
|
|
|
|
|
assert "$LOCAL 2>&1 -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: server set to listen on 127.0.0.1:8388, are you sure?"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
|
|
|
assert "$LOCAL 2>&1 -m rc4-md5 -k testrc4 -s 0.0.0.0 -p 8388 -t10 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: your timeout 10 seems too short"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
|
|
|
assert "$LOCAL 2>&1 -m rc4-md5 -k testrc4 -s 0.0.0.0 -p 8388 -t1000 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: your timeout 1000 seems too long"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
|
|
|
assert "$LOCAL 2>&1 -m rc4 -k testrc4 -s 0.0.0.0 -p 8388 -d start | grep WARNING | awk -F\"WARNING\" '{print \$2}'" " warning: RC4 is not safe; please use a safer cipher, like AES-256-CFB"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
|
|
|
assert "$LOCAL 2>&1 -m rc4-md5 -k mypassword -s 0.0.0.0 -p 8388 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" " DON'T USE DEFAULT PASSWORD! Please change it in your config.json!"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
2016-11-20 06:59:32 +00:00
|
|
|
assert "$LOCAL 2>&1 -m rc4-md5 -p 8388 -k testrc4 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" " server addr not specified"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
2015-02-02 07:59:44 +00:00
|
|
|
assert "$LOCAL 2>&1 -m rc4-md5 -p 8388 -s 0.0.0.0 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" " password not specified"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
2015-02-02 07:59:44 +00:00
|
|
|
assert "$SERVER 2>&1 -m rc4-md5 -p 8388 -s 0.0.0.0 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" " password or port_password not specified"
|
2014-12-24 10:15:52 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
2016-11-20 06:59:32 +00:00
|
|
|
assert "$SERVER 2>&1 --forbidden-ip 127.0.0.1/4a -m rc4-md5 -k 12345 -p 8388 -s 0.0.0.0 -d start | grep ERROR | awk -F\"ERROR\" '{print \$2}'" " Not a valid CIDR notation: 127.0.0.1/4a"
|
2015-02-01 01:13:29 +00:00
|
|
|
$LOCAL 2>/dev/null 1>/dev/null -m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -d stop
|
2014-12-24 10:02:14 +00:00
|
|
|
|
|
|
|
assert_end command
|