aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nullmailer/fix-tests-catch-port.patch
blob: 54bace93620760c71ab7921e467851a2dff75f4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Simon Frankenberger <simon-alpine@fraho.eu>
Date: Wed, 16 Sep 2020 09:46:13 +0200
Subject: fix port detection from tcpserver in tests

It seems that the port printed out by tcpserver differs from
the expected form. Use some bash magic to extract the port number
from the logline (last element in last line, separated by space).

--- old/test/functions.in
+++ new/test/functions.in
@@ -52,6 +52,7 @@
 catch-port() {
     local name=$1
     port=$( head -n 1 $tmpdir/service/${name}-log )
+    port=${port##* }
 }
 
 #not() { if "$@"; then return 1; else return 0; fi }
--- old/test/tests/protocols
+++ new/test/tests/protocols
@@ -51,6 +51,7 @@
 
 	start server tcpserver -1 0 0 date
 	port=$( head -n 1 $tmpdir/service/server-log )
+	port=${port##* }
 	echo "Testing protocol failure with $p."
 	error 11 protocol $p -p $port --host=localhost 3<$testmail
 	stop server