[M] Change in osmo-ttcn3-hacks[master]: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates...
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email ) Change subject: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn .. 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(-) 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 diff --git a/library/PIPEasp_Templates.ttcn b/library/PIPEasp_Templates.ttcn new file mode 100644 index 000..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 https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a Gerrit-Change-Number: 36832 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-MessageType: merged
[M] Change in osmo-ttcn3-hacks[master]: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates...
Attention is currently required from: dexter, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email ) Change subject: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a Gerrit-Change-Number: 36832 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Attention: pespin Gerrit-Attention: dexter Gerrit-Comment-Date: Thu, 16 May 2024 06:15:20 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in osmo-ttcn3-hacks[master]: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates...
Attention is currently required from: dexter, fixeria, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email ) Change subject: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a Gerrit-Change-Number: 36832 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Attention: dexter Gerrit-Comment-Date: Wed, 15 May 2024 14:56:07 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in osmo-ttcn3-hacks[master]: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates...
Attention is currently required from: dexter, fixeria, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email ) Change subject: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn .. Patch Set 1: (1 comment) Patchset: PS1: adding @pma...@sysmocom.de as I know he also has been using PIPEasp recently in his eIM/IPAd tests -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a Gerrit-Change-Number: 36832 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter Gerrit-Reviewer: fixeria Gerrit-Reviewer: osmith Gerrit-CC: laforge Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Attention: dexter Gerrit-Comment-Date: Wed, 15 May 2024 14:55:59 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
[M] Change in osmo-ttcn3-hacks[master]: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates...
Attention is currently required from: fixeria, pespin. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email ) Change subject: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a Gerrit-Change-Number: 36832 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: osmith Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Comment-Date: Wed, 15 May 2024 14:05:38 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in osmo-ttcn3-hacks[master]: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates...
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email ) Change subject: remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn .. 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/32/36832/1 diff --git a/library/PIPEasp_Templates.ttcn b/library/PIPEasp_Templates.ttcn new file mode 100644 index 000..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 https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36832?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a Gerrit-Change-Number: 36832 Gerrit-PatchSet: 1 Gerrit-Owner: pespin Gerrit-MessageType: newchange