Change in ...osmo-pcu[master]: tests/app_info: fix compiling with older g++

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Wed Sep 18 13:55:28 UTC 2019


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-pcu/+/15564 )

Change subject: tests/app_info: fix compiling with older g++
......................................................................

tests/app_info: fix compiling with older g++

Do not use C++11 extended initializers to prevent the following error.

AppInfoTest.cpp:109:54: error: extended initializer lists only available with -std=c++11 or -std=gnu++11
  pcu_prim.u.app_info_req = {0, 15, {0xff, 0x00, 0xff}};

I ran into this when modifying the gerrit build verification job to
build with docker (which still uses GCC-4.9).

Related: OS#4204
Change-Id: I307cd87af88e86804a90d6466e9cc3909bfe701f
---
M tests/app_info/AppInfoTest.cpp
1 file changed, 17 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/tests/app_info/AppInfoTest.cpp b/tests/app_info/AppInfoTest.cpp
index c4cf548..ca2c59e 100644
--- a/tests/app_info/AppInfoTest.cpp
+++ b/tests/app_info/AppInfoTest.cpp
@@ -47,14 +47,14 @@
 	fprintf(stderr, "\n");
 }
 
-void test_enc() {
-	struct gsm_pcu_if_app_info_req req = {0, 15, {0xff, 0x00, 0xff}};
+void test_enc(const struct gsm_pcu_if_app_info_req *req)
+{
 	const char *exp = "03 fc 03 fc 00 00 00 00 00 00 00 00 00 00 00 00 "; /* shifted by two bits to the right */
 	struct msgb *msg;
 	char *msg_dump;
 
 	fprintf(stderr, "--- %s ---\n",  __func__);
-	msg = gprs_rlcmac_app_info_msg(&req);
+	msg = gprs_rlcmac_app_info_msg(req);
 	msg_dump = msgb_hexdump_c(tall_pcu_ctx, msg);
 
 	fprintf(stderr, "exp: %s\n", exp);
@@ -100,13 +100,13 @@
 	fprintf(stderr, "\n");
 }
 
-void test_sched_app_info_ok()
+void test_sched_app_info_ok(const struct gsm_pcu_if_app_info_req *req)
 {
 	struct gsm_pcu_if pcu_prim = {PCU_IF_MSG_APP_INFO_REQ, };
 	struct msgb *msg;
 
 	fprintf(stderr, "--- %s ---\n",  __func__);
-	pcu_prim.u.app_info_req = {0, 15, {0xff, 0x00, 0xff}};
+	pcu_prim.u.app_info_req = *req;
 	pcu_rx(PCU_IF_MSG_APP_INFO_REQ, &pcu_prim);
 
 	msg = sched_app_info(tbf1);
@@ -120,13 +120,13 @@
 	fprintf(stderr, "\n");
 }
 
-void test_sched_app_info_missing_app_info_in_bts()
+void test_sched_app_info_missing_app_info_in_bts(const struct gsm_pcu_if_app_info_req *req)
 {
 	struct gprs_rlcmac_bts *bts_data = BTS::main_bts()->bts_data();
 	struct gsm_pcu_if pcu_prim = {PCU_IF_MSG_APP_INFO_REQ, };
 
 	fprintf(stderr, "--- %s ---\n",  __func__);
-	pcu_prim.u.app_info_req = {0, 15, {0xff, 0x00, 0xff}};
+	pcu_prim.u.app_info_req = *req;
 	pcu_rx(PCU_IF_MSG_APP_INFO_REQ, &pcu_prim);
 
 	msgb_free(bts_data->app_info);
@@ -137,12 +137,12 @@
 	fprintf(stderr, "\n");
 }
 
-void test_pcu_rx_overwrite_app_info()
+void test_pcu_rx_overwrite_app_info(const struct gsm_pcu_if_app_info_req *req)
 {
 	struct gsm_pcu_if pcu_prim = {PCU_IF_MSG_APP_INFO_REQ, };
 
 	fprintf(stderr, "--- %s ---\n",  __func__);
-	pcu_prim.u.app_info_req = {0, 15, {0xff, 0x00, 0xff}};
+	pcu_prim.u.app_info_req = *req;
 	pcu_rx(PCU_IF_MSG_APP_INFO_REQ, &pcu_prim);
 	pcu_rx(PCU_IF_MSG_APP_INFO_REQ, &pcu_prim);
 	fprintf(stderr, "\n");
@@ -162,6 +162,10 @@
 
 int main(int argc, char *argv[])
 {
+	struct gsm_pcu_if_app_info_req req = {0, 15, {0}};
+	const uint8_t req_data[] = {0xff, 0x00, 0xff};
+	memcpy(req.data, req_data, 3);
+
 	tall_pcu_ctx = talloc_named_const(NULL, 1, "AppInfoTest");
 	osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
 	log_set_use_color(osmo_stderr_target, 0);
@@ -169,13 +173,13 @@
 	log_parse_category_mask(osmo_stderr_target, "DL1IF,1:DRLCMAC,3:DRLCMACSCHED,1");
 
 	test_enc_zero_len();
-	test_enc();
+	test_enc(&req);
 	test_pcu_rx_no_subscr_with_active_tbf();
 
 	prepare_bts_with_two_dl_tbf_subscr();
-	test_sched_app_info_ok();
-	test_sched_app_info_missing_app_info_in_bts();
-	test_pcu_rx_overwrite_app_info();
+	test_sched_app_info_ok(&req);
+	test_sched_app_info_missing_app_info_in_bts(&req);
+	test_pcu_rx_overwrite_app_info(&req);
 
 	cleanup();
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15564
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I307cd87af88e86804a90d6466e9cc3909bfe701f
Gerrit-Change-Number: 15564
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190918/8fd9380a/attachment.htm>


More information about the gerrit-log mailing list