diff options
author | Oliver Smith <osmith@sysmocom.de> | 2019-09-18 13:47:25 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2019-09-18 13:58:42 +0200 |
commit | 2beb1b85e05ba34c1fc3291b6fe177775bffb235 (patch) | |
tree | 94e8249c568ed83c8b7b9fb3321e8f07cda20af6 | |
parent | 2b5c6290558c7d7c9c4161e21f371a81482ad892 (diff) |
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
-rw-r--r-- | tests/app_info/AppInfoTest.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/app_info/AppInfoTest.cpp b/tests/app_info/AppInfoTest.cpp index c4cf548d..ca2c59e2 100644 --- a/tests/app_info/AppInfoTest.cpp +++ b/tests/app_info/AppInfoTest.cpp @@ -47,14 +47,14 @@ void test_enc_zero_len() { 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 @@ void prepare_bts_with_two_dl_tbf_subscr() 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 @@ void test_sched_app_info_ok() 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 @@ void test_sched_app_info_missing_app_info_in_bts() 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 @@ void cleanup() 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 @@ int main(int argc, char *argv[]) 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(); } |