]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/commitdiff
tests: Kill PIDs in stop_servers(), not process names.
authorSimon Ruderich <simon@ruderich.org>
Sun, 28 Jul 2013 11:44:09 +0000 (13:44 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 28 Jul 2013 11:44:09 +0000 (13:44 +0200)
tests/common.sh
tests/tests-normal.sh
tests/tests-passthrough.sh

index 8b93ce41b2f722fea6d1bd942b0b9b63b0fc780f..587b5f897f56e3b97b5c61a7addb07bd3a824d57 100644 (file)
@@ -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
index b6d6c1d7b97ba90dbef4f56a430f811bfa7847a9..01621eab18fe3348f9ef4820db4a9718d0a65945 100755 (executable)
@@ -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
index 5bac5bf8b784a90690f88dfc544f4fc43ff9c71d..9fb747ed645cb66c24bb2601e625fb1035727fc5 100755 (executable)
@@ -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