]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - tests/common.sh
tests: Remove tmp in cleanup().
[tlsproxy/tlsproxy.git] / tests / common.sh
index 8b93ce41b2f722fea6d1bd942b0b9b63b0fc780f..c66fa55216815bb68861a71554db00958bd88a20 100644 (file)
@@ -21,20 +21,26 @@ set -e
 
 cleanup() {
     rm -f \
+        tmp \
         certificate-localhost-proxy.pem certificate-localhost-server.pem \
         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