jolly has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43268?usp=email )
Change subject: IPA: Start (and stop) IPAd from test cases
......................................................................
IPA: Start (and stop) IPAd from test cases
Start IPAd from test case, rather than running it in a shell loop during
all tests. The IPAd is started for every test case. If it does not
terminate for some reason, it is killed at the end.
Command line options can be added for later tests. This allows to test
functions that are triggered/enabled/disabled via command line.
Related: SYS#8101
Change-Id: I178f8e8750bcd8e1ddbe9a16c615be4bb3e64c1c
---
M ipad/IPAd_Tests.ttcn
M ipad/gen_links.sh
M ipad/regen_makefile.sh
M ipad/testenv.cfg
4 files changed, 51 insertions(+), 2 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
dexter: Looks good to me, approved
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn
index 95f6b06..d93297b 100644
--- a/ipad/IPAd_Tests.ttcn
+++ b/ipad/IPAd_Tests.ttcn
@@ -33,6 +33,10 @@
import from VPCD_CodecPort all;
import from VPCD_Adapter all;
+import from PIPEasp_PortType all;
+import from PIPEasp_Types all;
+import from PIPEasp_Templates all;
+
modulepar {
/* emulated eIM HTTPs server */
charstring mp_esipa_ip := "127.0.0.1";
@@ -92,6 +96,11 @@
type component IPAd_ConnHdlr extends HTTP_ConnHdlr, VPCD_Adapter_CT {
var IPAd_ConnHdlrPars g_pars;
+ port PIPEasp_PT PIPE;
+};
+
+type component IPAd_Launcher extends VPCD_Adapter_CT {
+ port PIPEasp_PT PIPE;
};
type record IPAd_ConnHdlrPars {
@@ -440,6 +449,30 @@
f_esipa_transceive(valueof(ts_getEimPackageResponse_noEimPackageAvailable),
tr_getEimPackageRequest);
}
+/* Run IPAd once in the background.
+ * Do a delayed start, so that the test case is ready to handle requests from
IPAd. */
+private function f_exec_bg(charstring parameters) runs on IPAd_Launcher {
+ f_sleep(1.0);
+ map(self:PIPE, system:PIPE);
+ f_PIPEasp_exec_async_start(PIPE, "sh", "rm -f nvstate.bin ; " &
+ "onomondo-ipa -C
example_ca/pki/issued/alttest.cabundle " &
+ parameters &
+ " 2>&1 | tee -i /tmp/single_log
>> onomondo-ipa.log");
+
+ unmap(self:PIPE, system:PIPE);
+}
+private function f_exec_ipad(charstring parameters := "") runs on
IPAd_ConnHdlr {
+ var IPAd_Launcher v_launcher := IPAd_Launcher.create;
+ v_launcher.start(f_exec_bg(parameters));
+}
+
+/* Stop IPAd, if still running. */
+private function f_stop_ipad(charstring parameters := "") runs on
IPAd_ConnHdlr {
+ map(self:PIPE, system:PIPE);
+ f_PIPEasp_exec_async_stop(PIPE, "onomondo-ipa");
+ unmap(self:PIPE, system:PIPE);
+}
+
/* ********************************************* */
/* ********** BELOW ONLY TESTCASES! ************ */
/* ********************************************* */
@@ -452,6 +485,7 @@
var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
var BoundProfilePackage boundProfilePackage;
+ f_exec_ipad();
f_es10x_init();
f_http_register();
@@ -515,6 +549,7 @@
f_sleep(2.0);
f_es10x_close();
+ f_stop_ipad();
setverdict(pass);
}
@@ -532,6 +567,7 @@
/* A testcase to try out an the Generic eUICC Package Download and Execution
Procedure,
* See also: GSMA SGP.32, section 3.3.1: Generic eUICC Package Download and
Execution */
private function f_TC_proc_euicc_pkg_dwnld_exec(charstring id) runs on
IPAd_ConnHdlr {
+ f_exec_ipad();
f_es10x_init();
f_http_register();
@@ -562,6 +598,7 @@
f_sleep(2.0);
f_es10x_close();
+ f_stop_ipad();
setverdict(pass);
}
@@ -580,6 +617,7 @@
/* A testcase to try out an the Generic eUICC Package Download and Execution
Procedure,
* but this time we force a rollback meneuver */
private function f_TC_proc_euicc_pkg_dwnld_exec_rollback(charstring id) runs
on IPAd_ConnHdlr {
+ f_exec_ipad();
f_es10x_init();
f_http_register();
@@ -633,6 +671,7 @@
f_sleep(2.0);
f_es10x_close();
+ f_stop_ipad();
setverdict(pass);
}
@@ -652,6 +691,7 @@
private function f_TC_proc_euicc_data_req(charstring id) runs on IPAd_ConnHdlr
{
var charstring eim_fqdn := mp_esipa_ip & ":" & int2str(mp_esipa_port);
+ f_exec_ipad();
f_es10x_init();
f_http_register();
@@ -677,6 +717,7 @@
f_sleep(2.0);
f_es10x_close();
+ f_stop_ipad();
setverdict(pass);
}
@@ -695,6 +736,7 @@
var EsipaMessageFromIpaToEim esipa_req;
var EsipaMessageFromEimToIpa esipa_res;
+ f_exec_ipad();
f_es10x_init();
f_http_register();
@@ -705,6 +747,7 @@
f_sleep(2.0);
f_es10x_close();
+ f_stop_ipad();
setverdict(pass);
}
diff --git a/ipad/gen_links.sh b/ipad/gen_links.sh
index a0b8197..29bda02 100755
--- a/ipad/gen_links.sh
+++ b/ipad/gen_links.sh
@@ -26,6 +26,10 @@
FILES+="IPL4asp_discovery.cc IPL4asp_protocol_L234.hh"
gen_links $DIR $FILES
+DIR=$BASEDIR/titan.TestPorts.PIPEasp/src
+FILES="PIPEasp_PT.cc PIPEasp_PT.hh PIPEasp_Types.ttcn PIPEasp_PortType.ttcn "
+gen_links $DIR $FILES
+
DIR=../library/euicc
FILES="PEDefinitions.asn PKIX1Explicit88.asn PKIX1Implicit88.asn
RSPDefinitions.asn SGP32Definitions.asn "
FILES+="PKIX1Explicit88_Templates.ttcn PKIX1Explicit88_Types.ttcn
PKIX1Implicit88_Templates.ttcn "
@@ -36,7 +40,8 @@
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn
Native_Functions.ttcn Native_FunctionDefs.cc "
FILES+="VPCD_Types.ttcn VPCD_CodecPort.ttcn VPCD_CodecPort_CtrlFunct.ttcn
VPCD_CodecPort_CtrlFunctDef.cc "
-FILES+="VPCD_Adapter.ttcn HTTP_Server_Emulation.ttcn"
+FILES+="VPCD_Adapter.ttcn HTTP_Server_Emulation.ttcn "
+FILES+="PIPEasp_Templates.ttcn "
gen_links $DIR $FILES
gen_links_finish
diff --git a/ipad/regen_makefile.sh b/ipad/regen_makefile.sh
index 021de52..c57199c 100755
--- a/ipad/regen_makefile.sh
+++ b/ipad/regen_makefile.sh
@@ -14,6 +14,7 @@
TCCConversion.cc
TCCInterface.cc
VPCD_CodecPort_CtrlFunctDef.cc
+ PIPEasp_PT.cc
"
. ../_buildsystem/regen_makefile.inc.sh
diff --git a/ipad/testenv.cfg b/ipad/testenv.cfg
index 71d1ea1..dfec811 100644
--- a/ipad/testenv.cfg
+++ b/ipad/testenv.cfg
@@ -9,6 +9,6 @@
make=no
[ipad]
-program=sh -c 'while true; do onomondo-ipa -I; echo "Restart IPAd in one
second..."; sleep 1; done'
+# Gets started with f_exec_ipad() in IPAd_Tests.ttcn
make=onomondo-ipa
package=onomondo-ipa
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43268?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I178f8e8750bcd8e1ddbe9a16c615be4bb3e64c1c
Gerrit-Change-Number: 43268
Gerrit-PatchSet: 7
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>