summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-12-16 04:01:54 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-18 23:05:50 +0000
commit6769ad6e0aca58ccc037746885976ea4f85cb318 (patch)
tree92849d1dc71a03329f0f82320afb8af4560d9470 /tests
parent83aee83ec6a9d3d5e4f9251221c9639028d3da89 (diff)
ctrl_test: show memleak when receiving GET_REPLY and SET_REPLY commands
The "memleak!" output shows messages that lack a talloc_free() of the parsed ctrl command buffer. The leak shall be fixed in a subsequent patch. Change-Id: I2c3e4d08b769b9cd77593362ea36a28d681cd042
Diffstat (limited to 'tests')
-rw-r--r--tests/ctrl/ctrl_test.c24
-rw-r--r--tests/ctrl/ctrl_test.ok18
2 files changed, 40 insertions, 2 deletions
diff --git a/tests/ctrl/ctrl_test.c b/tests/ctrl/ctrl_test.c
index b3fa05ee..9c7316fc 100644
--- a/tests/ctrl/ctrl_test.c
+++ b/tests/ctrl/ctrl_test.c
@@ -120,8 +120,9 @@ static void assert_test(struct ctrl_handle *ctrl, struct ctrl_connection *ccon,
if (talloc_total_size(ctx) != ctx_size_was) {
printf("mem leak!\n");
- talloc_report_full(ctx, stdout);
- OSMO_ASSERT(false);
+ // hide mem leak to be fixed in subsequent patch
+ //talloc_report_full(ctx, stdout);
+ //OSMO_ASSERT(false);
}
printf("ok\n");
@@ -294,6 +295,25 @@ static const struct one_test test_messages_list[] = {
"ERROR \t Command not found",
},
+ { "GET_REPLY 1 variable OK",
+ {
+ .type = CTRL_TYPE_GET_REPLY,
+ .id = "1",
+ .variable = "variable",
+ .reply = "OK",
+ },
+ .reply_str = NULL,
+ },
+ { "SET_REPLY 1 variable OK",
+ {
+ .type = CTRL_TYPE_SET_REPLY,
+ .id = "1",
+ .variable = "variable",
+ .reply = "OK",
+ },
+ .reply_str = NULL,
+ },
+
};
static void test_messages()
diff --git a/tests/ctrl/ctrl_test.ok b/tests/ctrl/ctrl_test.ok
index edf97ead..9ddcfdb1 100644
--- a/tests/ctrl/ctrl_test.ok
+++ b/tests/ctrl/ctrl_test.ok
@@ -160,3 +160,21 @@ reply = '(null)'
handling:
replied: 'ERROR \t Command not found'
ok
+test: 'GET_REPLY 1 variable OK'
+parsing:
+id = '1'
+variable = 'variable'
+value = '(null)'
+reply = 'OK'
+handling:
+mem leak!
+ok
+test: 'SET_REPLY 1 variable OK'
+parsing:
+id = '1'
+variable = 'variable'
+value = '(null)'
+reply = 'OK'
+handling:
+mem leak!
+ok