Skip to content

Commit f1b084b

Browse files
author
clowwindy
committed
add large file test
1 parent 5ea8403 commit f1b084b

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.jenkins.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ if [ -f /proc/sys/net/ipv4/tcp_fastopen ] ; then
5353
fi
5454
fi
5555

56+
run_test tests/test_large_file.sh
57+
5658
coverage combine && coverage report --include=shadowsocks/*
5759
rm -rf htmlcov
5860
rm -rf tmp

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ cache:
99
- dante-1.4.0
1010
before_install:
1111
- sudo apt-get update -qq
12-
- sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils
12+
- sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils iproute nginx
13+
- sudo dd if=/dev/urandom of=/usr/share/nginx/www/file bs=1M count=10
14+
- sudo service nginx restart
1315
- pip install m2crypto salsa20 pep8 pyflakes nose coverage
1416
- sudo tests/socksify/install.sh
1517
- sudo tests/libsodium/install.sh

tests/test_large_file.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
DEV=lo
4+
PORT=8388
5+
DELAY=100ms
6+
7+
PYTHON="coverage run -p -a"
8+
URL=http://127.0.0.1/file
9+
10+
mkdir -p tmp
11+
12+
type tc > /dev/null && (
13+
tc qdisc add dev $DEV root handle 1: prio
14+
tc qdisc add dev $DEV parent 1:3 handle 30: netem delay $DELAY
15+
tc filter add dev $DEV parent 1:0 protocol ip u32 match ip dport $PORT 0xffff flowid 1:3
16+
tc filter add dev $DEV parent 1:0 protocol ip u32 match ip sport $PORT 0xffff flowid 1:3
17+
tc qdisc show dev lo
18+
)
19+
20+
$PYTHON shadowsocks/local.py -c tests/aes.json &
21+
LOCAL=$!
22+
23+
$PYTHON shadowsocks/server.py -c tests/aes.json &
24+
SERVER=$!
25+
26+
sleep 3
27+
28+
curl -o tmp/expected $URL
29+
curl -o tmp/result --socks5-hostname 127.0.0.1:1081 $URL
30+
31+
kill $LOCAL
32+
kill $SERVER
33+
34+
type tc > /dev/null && tc qdisc del dev lo root
35+
36+
sleep 2
37+
38+
diff tmp/expected tmp/result || exit 1

0 commit comments

Comments
 (0)