shadowsocks/tests/test_daemon.sh

44 lines
1.6 KiB
Bash
Raw Normal View History

2014-12-21 05:46:27 +00:00
#!/bin/bash
2014-12-22 08:33:23 +00:00
function run_test {
2014-12-21 05:46:27 +00:00
expected=$1
shift
echo "running test: $command $@"
$command $@
status=$?
if [ $status -ne $expected ]; then
echo "exit $status != $expected"
exit 1
fi
echo "exit status $status == $expected"
echo OK
return
}
for module in local server
do
2016-01-11 15:47:47 +00:00
command="coverage run -a shadowsocks/$module.py"
2014-12-21 05:46:27 +00:00
2014-12-22 09:39:52 +00:00
mkdir -p tmp
2014-12-21 05:46:27 +00:00
2014-12-22 09:39:52 +00:00
run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
2014-12-21 05:46:27 +00:00
2014-12-22 09:39:52 +00:00
run_test 0 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
2014-12-21 05:46:27 +00:00
2014-12-22 09:39:52 +00:00
run_test 0 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 1 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
2014-12-21 05:46:27 +00:00
2014-12-22 09:39:52 +00:00
run_test 0 -c tests/aes.json -d start --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 0 -c tests/aes.json -d restart --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
2014-12-21 05:46:27 +00:00
2014-12-22 09:39:52 +00:00
run_test 0 -c tests/aes.json -d restart --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 0 -c tests/aes.json -d stop --pid-file tmp/shadowsocks.pid --log-file tmp/shadowsocks.log
run_test 1 -c tests/aes.json -d start --pid-file tmp/not_exist/shadowsocks.pid --log-file tmp/shadowsocks.log
2014-12-21 05:46:27 +00:00
done