From: Simon Ruderich Date: Sun, 28 Jul 2013 11:44:09 +0000 (+0200) Subject: tests: Kill PIDs in stop_servers(), not process names. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=cf65dc05b04654c77b71d881e3196c2b5fa3d715;p=tlsproxy%2Ftlsproxy.git tests: Kill PIDs in stop_servers(), not process names. --- diff --git a/tests/common.sh b/tests/common.sh index 8b93ce4..587b5f8 100644 --- a/tests/common.sh +++ b/tests/common.sh @@ -25,16 +25,21 @@ cleanup() { proxy-ca-key.pem proxy-ca.pem proxy-invalid.pem proxy-key.pem } stop_servers() { - pkill -n gnutls-serv - pkill -n tlsproxy + kill $pid_server || echo 'failed to kill gnutls-serv' + kill $pid_tlsproxy || echo 'failed to kill tlsproxy' } abort() { echo "abort: $*" stop_servers exit 1 } +tlsproxy() { + ../src/tlsproxy -d2 "$@" >/dev/null & + pid_tlsproxy=$! +} server() { gnutls-serv --http --port 4712 "$@" >/dev/null 2>&1 & + pid_server=$! } client() { ./client ./proxy-ca.pem "$@" > tmp 2>&1 diff --git a/tests/tests-normal.sh b/tests/tests-normal.sh index b6d6c1d..01621ea 100755 --- a/tests/tests-normal.sh +++ b/tests/tests-normal.sh @@ -27,7 +27,7 @@ cleanup "$srcdir/../src/tlsproxy-setup" >/dev/null 2>/dev/null # Normal tests. -../src/tlsproxy -d2 4711 >/dev/null & +tlsproxy 4711 server --x509certfile "$srcdir/server.pem" \ --x509keyfile "$srcdir/server-key.pem" sleep 1 @@ -70,7 +70,7 @@ test_no_invalid_certificate # Stop server and try a "MITM" with a bad certificate. echo -pkill -n gnutls-serv +kill $pid_server || echo 'failed to kill gnutls-serv' server --x509certfile "$srcdir/server-bad.pem" \ --x509keyfile "$srcdir/server-key.pem" sleep 1 diff --git a/tests/tests-passthrough.sh b/tests/tests-passthrough.sh index 5bac5bf..9fb747e 100755 --- a/tests/tests-passthrough.sh +++ b/tests/tests-passthrough.sh @@ -27,7 +27,7 @@ cleanup "$srcdir/../src/tlsproxy-setup" >/dev/null 2>/dev/null # Normal tests. -../src/tlsproxy -d2 -u 4711 >/dev/null & +tlsproxy -u 4711 server --x509certfile "$srcdir/server.pem" \ --x509keyfile "$srcdir/server-key.pem" sleep 1 @@ -72,7 +72,7 @@ test_no_invalid_certificate # Stop server and try a "MITM" with a bad certificate. echo -pkill -n gnutls-serv +kill $pid_server || echo 'failed to kill gnutls-serv' server --x509certfile "$srcdir/server-bad.pem" \ --x509keyfile "$srcdir/server-key.pem" sleep 1