Files
shadowsocks/tests/test_large_file.sh

39 lines
812 B
Bash
Raw Normal View History

2014-12-23 13:09:51 +08:00
#!/bin/bash
DEV=lo
PORT=8388
DELAY=100ms
PYTHON="coverage run -p -a"
URL=http://127.0.0.1/file
mkdir -p tmp
2014-12-23 13:18:30 +08:00
type tc 2> /dev/null && (
2014-12-23 13:09:51 +08:00
tc qdisc add dev $DEV root handle 1: prio
tc qdisc add dev $DEV parent 1:3 handle 30: netem delay $DELAY
tc filter add dev $DEV parent 1:0 protocol ip u32 match ip dport $PORT 0xffff flowid 1:3
tc filter add dev $DEV parent 1:0 protocol ip u32 match ip sport $PORT 0xffff flowid 1:3
tc qdisc show dev lo
)
$PYTHON shadowsocks/local.py -c tests/aes.json &
LOCAL=$!
$PYTHON shadowsocks/server.py -c tests/aes.json &
SERVER=$!
sleep 3
2014-12-23 13:18:30 +08:00
time curl -o tmp/expected $URL
time curl -o tmp/result --socks5-hostname 127.0.0.1:1081 $URL
2014-12-23 13:09:51 +08:00
kill $LOCAL
kill $SERVER
2014-12-23 13:18:30 +08:00
type tc 2> /dev/null && tc qdisc del dev lo root
2014-12-23 13:09:51 +08:00
sleep 2
diff tmp/expected tmp/result || exit 1