-
Notifications
You must be signed in to change notification settings - Fork 13
/
.coverage.sh
57 lines (50 loc) · 1.73 KB
/
.coverage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -e
# build libmill
rm -rf libmill
curl -s -L https://github.com/sustrik/libmill/archive/master.tar.gz | tar -zxf -
mv libmill-master libmill
cd libmill
./autogen.sh
./configure --enable-shared=false
make libmill.la
cd ../
# build with coverage
if [ -f Makefile ]; then
make distclean
fi
autoreconf -if
export CPPFLAGS
CPPFLAGS=-I$(pwd)/libmill
export LDFLAGS
LDFLAGS=-L$(pwd)/libmill/.libs
export CFLAGS="-fprofile-arcs -ftest-coverage"
./configure --enable-debug
sed -i 's/nobody/root/g' src/main.c
make
sed -i 's/root/nobody/g' src/main.c
# run tests
src/sniproxy -h || true
src/sniproxy -a || true
src/sniproxy -w || true
src/sniproxy --nothisoption || true
sudo src/sniproxy -a 127.0.0.1 -w 4 &
sleep 1
curl -vv --resolve github.com:80:127.0.0.1 http://github.com/
curl -vv --resolve twitter.com:80:127.0.0.1 http://twitter.com/
curl -vv --resolve github.com:80:127.0.0.1 "http://github.com/?foo=$(dd if=/dev/urandom bs=1 count=8000 | base32 -w 0)"
curl -vv --resolve github.com:443:127.0.0.1 -o /dev/null https://github.com/
curl -vv --resolve twitter.com:443:127.0.0.1 -o /dev/null https://twitter.com/
sudo pkill -INT sniproxy
sudo src/sniproxy -a 127.0.0.1 -w 4 --socks5 127.0.0.1:1080 &
sleep 1
curl -vv --resolve github.com:80:127.0.0.1 http://github.com/
curl -vv --resolve twitter.com:80:127.0.0.1 http://twitter.com/
curl -vv --resolve github.com:80:127.0.0.1 "http://github.com/?foo=$(dd if=/dev/urandom bs=1 count=8000 | base32 -w 0)"
curl -vv --resolve github.com:443:127.0.0.1 -o /dev/null https://github.com/
curl -vv --resolve twitter.com:443:127.0.0.1 -o /dev/null https://twitter.com/
sudo pkill -INT sniproxy
# send coverage report to codecov.io
bash <(curl -s https://codecov.io/bash)
# cleanup
make distclean