pespin submitted this change.

View Change


Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved
remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn

This way code can be used and extended for other testsuites.

Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a
---
A library/PIPEasp_Templates.ttcn
M remsim/RemsimClient_Tests.ttcn
M remsim/gen_links.sh
3 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/library/PIPEasp_Templates.ttcn b/library/PIPEasp_Templates.ttcn
new file mode 100644
index 0000000..af4e434
--- /dev/null
+++ b/library/PIPEasp_Templates.ttcn
@@ -0,0 +1,27 @@
+module PIPEasp_Templates {
+
+import from PIPEasp_PortType all;
+import from PIPEasp_Types all;
+
+template (value) ASP_PExecuteBackground ts_ExecBg(charstring cmd) := {
+ command := cmd
+}
+
+template (present) ASP_PStdout tr_Stdout(template (present) charstring line) := {
+ stdout := line
+}
+
+template (present) ASP_PStderr tr_Stderr(template (present) charstring line) := {
+ stderr := line
+}
+
+template (value) ASP_PStdin ts_Stdin(template (value) charstring line) := {
+ stdin :=line
+}
+
+/* Ignore output from stderr: */
+altstep as_ignore_stderr(PIPEasp_PT pt) {
+[] pt.receive(tr_Stderr(?)) { repeat; }
+}
+
+}
diff --git a/remsim/RemsimClient_Tests.ttcn b/remsim/RemsimClient_Tests.ttcn
index 219573c..d747eef 100644
--- a/remsim/RemsimClient_Tests.ttcn
+++ b/remsim/RemsimClient_Tests.ttcn
@@ -20,6 +20,7 @@
/* the PIPEasp port allows us to interact with osmo-remsim-client-shell via stdin/stdout */
import from PIPEasp_PortType all;
import from PIPEasp_Types all;
+import from PIPEasp_Templates all;

import from RSPRO all;
import from RSPRO_Types all;
@@ -196,34 +197,13 @@
* Tests interacting with local remsim-bankd-client via PIPE port
***********************************************************************/

-template (value) ASP_PExecuteBackground ts_ExecBg(charstring cmd) := {
- command := cmd
-}
-
-template (present) ASP_PStdout tr_Stdout(template (present) charstring line) := {
- stdout := line
-}
-
-template (present) ASP_PStderr tr_Stderr(template (present) charstring line) := {
- stderr := line
-}
-
-template (value) ASP_PStdin ts_Stdin(template (value) charstring line) := {
- stdin :=line
-}
-
-/* osmo-remsim-client logs to stderr, so we need to ignore that log output */
-private altstep as_ignore_stderr() runs on client_test_CT {
-[] PIPE.receive(tr_Stderr(?)) { repeat; }
-}
-
/* start a local osmo-remsim-client as sub-process and attach it to PIPE port */
private function f_init_client_pipe(ClientSlot cs) runs on client_test_CT {
var charstring cmdline := mp_client_shell_cmd & " -i 127.0.0.1";
map(self:PIPE, system:PIPE);
PIPE.send(ts_ExecBg(cmdline & " -c " & int2str(cs.clientId)
& " -n " & int2str(cs.slotNr)));
- activate(as_ignore_stderr());
+ activate(as_ignore_stderr(PIPE));
}

/* pretty-print an octet string as series of ASCII encoded hex bytes with spaces */
diff --git a/remsim/gen_links.sh b/remsim/gen_links.sh
index b25375b..615c550 100755
--- a/remsim/gen_links.sh
+++ b/remsim/gen_links.sh
@@ -39,6 +39,7 @@

DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_VTY_Functions.ttcn Osmocom_Types.ttcn "
+FILES+="PIPEasp_Templates.ttcn "
FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn " #RSL_Types.ttcn RSL_Emulation.ttcn "
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
FILES+="Native_Functions.ttcn Native_FunctionDefs.cc "

To view, visit change 36832. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a
Gerrit-Change-Number: 36832
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged