shadowsocks/tests/jenkins.sh

91 lines
4 KiB
Bash
Raw Normal View History

2014-12-22 08:33:23 +00:00
#!/bin/bash
result=0
function run_test {
printf '\e[0;36m'
echo "running test: $command $@"
printf '\e[0m'
2014-12-22 08:45:46 +00:00
$command "$@"
2014-12-22 08:33:23 +00:00
status=$?
if [ $status -ne 0 ]; then
printf '\e[0;31m'
echo "test failed: $command $@"
printf '\e[0m'
echo
result=1
else
printf '\e[0;32m'
echo OK
printf '\e[0m'
echo
fi
return 0
}
2015-01-23 06:06:01 +00:00
python --version
2014-12-22 08:33:23 +00:00
coverage erase
2014-12-22 09:39:52 +00:00
mkdir tmp
2015-02-09 06:43:11 +00:00
run_test pep8 --ignore=E402 .
2014-12-22 08:33:23 +00:00
run_test pyflakes .
run_test coverage run tests/nose_plugin.py -v
run_test python setup.py sdist
run_test tests/test_daemon.sh
run_test python tests/test.py --with-coverage -c tests/aes.json
run_test python tests/test.py --with-coverage -c tests/aes-ctr.json
run_test python tests/test.py --with-coverage -c tests/aes-cfb1.json
run_test python tests/test.py --with-coverage -c tests/aes-cfb8.json
run_test python tests/test.py --with-coverage -c tests/rc4-md5.json
run_test python tests/test.py --with-coverage -c tests/salsa20.json
run_test python tests/test.py --with-coverage -c tests/chacha20.json
run_test python tests/test.py --with-coverage -c tests/table.json
run_test python tests/test.py --with-coverage -c tests/server-multi-ports.json
run_test python tests/test.py --with-coverage -s tests/aes.json -c tests/client-multi-server-ip.json
2015-08-17 02:14:23 +00:00
run_test python tests/test.py --with-coverage -s tests/server-dnsserver.json -c tests/client-multi-server-ip.json
2014-12-22 08:33:23 +00:00
run_test python tests/test.py --with-coverage -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json
run_test python tests/test.py --with-coverage -c tests/workers.json
2016-01-12 02:34:48 +00:00
run_test python tests/test.py --with-coverage -c tests/rc4-md5-ota.json
# travis-ci not support IPv6
# run_test python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json
2014-12-24 10:02:14 +00:00
run_test python tests/test.py --with-coverage -b "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -q" -a "-m rc4-md5 -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -vv"
2014-12-24 10:08:16 +00:00
run_test python tests/test.py --with-coverage -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --workers 1" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -qq -b 127.0.0.1"
2015-02-01 01:38:32 +00:00
run_test python tests/test.py --with-coverage --should-fail --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --forbidden-ip=127.0.0.1,::1,8.8.8.8" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1"
2014-12-22 09:58:12 +00:00
# test if DNS works
2016-01-11 17:55:42 +00:00
run_test python tests/test.py --with-coverage -c tests/aes.json --url="https://clients1.google.com/generate_204"
# test localhost is in the forbidden list by default
2015-02-01 01:38:32 +00:00
run_test python tests/test.py --with-coverage --should-fail --tcp-only --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1"
2015-02-01 01:24:49 +00:00
# test localhost is available when forbidden list is empty
2015-02-01 01:38:32 +00:00
run_test python tests/test.py --with-coverage --tcp-only --url="http://127.0.0.1/" -b "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 --forbidden-ip=" -a "-m aes-256-cfb -k testrc4 -s 127.0.0.1 -p 8388 -l 1081 -t 30 -b 127.0.0.1"
2014-12-22 09:58:12 +00:00
if [ -f /proc/sys/net/ipv4/tcp_fastopen ] ; then
if [ 3 -eq `cat /proc/sys/net/ipv4/tcp_fastopen` ] ; then
2014-12-25 08:20:15 +00:00
# we have to run it twice:
# the first time there's no syn cookie
# the second time there is syn cookie
run_test python tests/test.py --with-coverage -c tests/fastopen.json
2014-12-22 09:58:12 +00:00
run_test python tests/test.py --with-coverage -c tests/fastopen.json
fi
fi
2014-12-23 05:09:51 +00:00
run_test tests/test_large_file.sh
2015-08-02 09:33:13 +00:00
if [ "a$JENKINS" != "a1" ] ; then
# jenkins blocked SIGQUIT with sigprocmask(), we have to skip this test on Jenkins
run_test tests/test_graceful_restart.sh
fi
2015-07-10 07:02:33 +00:00
run_test tests/test_udp_src.sh
2014-12-24 10:10:12 +00:00
run_test tests/test_command.sh
2014-12-22 08:33:23 +00:00
coverage combine && coverage report --include=shadowsocks/*
rm -rf htmlcov
2014-12-22 09:39:52 +00:00
rm -rf tmp
2014-12-22 08:33:23 +00:00
coverage html --include=shadowsocks/*
2014-12-24 08:47:14 +00:00
coverage report --include=shadowsocks/* | tail -n1 | rev | cut -d' ' -f 1 | rev > /tmp/shadowsocks-coverage
2014-12-22 08:33:23 +00:00
exit $result