bts: Add test ensuring only one connection to PCU interface accepted

This adds TC_pcu_socket_connect_multi, which verifies that a second
connection to the PCU Intrerface socket is denied while the first
connection is still established.

Change-Id: Ib484a0a39e719cb2ce00a9464fc1207357ec9e93
Related: OS#4023
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 47c16c2..2885628 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -50,6 +50,7 @@
 
 import from PCUIF_Types all;
 import from PCUIF_CodecPort all;
+import from UD_Types all;
 
 import from MobileL3_CommonIE_Types all;
 import from MobileL3_RRM_Types all;
@@ -3896,6 +3897,30 @@
 	vc_conn.done;
 }
 
+/* Ensure that PCUIF socket can accept only a single connection */
+testcase TC_pcu_socket_connect_multi() runs on test_CT {
+	timer T := 5.0;
+
+	/* this (among other things) establishes the first connection to the PCUIF socket */
+	f_init();
+
+	/* try to establish a second connection, expect it to fail */
+	PCU.send(UD_connect:{mp_pcu_socket, -1});
+	T.start;
+	alt {
+	[] PCU.receive(UD_connect_result:{id := ?, result := { result_code := ERROR, err := ? }}) {
+		setverdict(pass);
+		}
+	[] PCU.receive(UD_connect_result:?) {
+		setverdict(fail, "Unexpected unix domain connect result");
+		}
+	[] T.timeout {
+		setverdict(pass);
+		}
+	}
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+}
+
 
 /***********************************************************************
  * Osmocom Style Dynamic Timeslot Support
@@ -5204,6 +5229,7 @@
 		execute( TC_pcu_rts_req() );
 		execute( TC_pcu_oml_alert() );
 		execute( TC_pcu_rr_suspend() );
+		execute( TC_pcu_socket_connect_multi() );
 	} else {
 		log("PCU socket path not available, skipping PCU tests");
 	}