aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-11-13 22:48:37 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-11-14 13:35:42 +0100
commitbf12800c51e3b470851a42272e083120f649a96b (patch)
tree257dfed9802c5408d9b7e1af80c4040fd7c9d81e /tests
parent72eb44cc51c2172a0880c8cef46f5873af180836 (diff)
tests: Initialize log system to fix crash, update test result
Use osmo_init_logging to initialize the log system to fix crashes when we attempt to parse broken ASN1 messages. Ignore stderr with parse errors, update the test result. make check is now passing.
Diffstat (limited to 'tests')
-rw-r--r--tests/testsuite.at2
-rw-r--r--tests/ussd/ussd_test.c6
-rw-r--r--tests/ussd/ussd_test.ok54
3 files changed, 60 insertions, 2 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 0e917f17..b33b04a5 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -41,5 +41,5 @@ AT_CLEANUP
AT_SETUP([ussd])
AT_KEYWORDS([ussd])
cat $abs_srcdir/ussd/ussd_test.ok > expout
-AT_CHECK([$abs_top_builddir/tests/ussd/ussd_test], [], [expout])
+AT_CHECK([$abs_top_builddir/tests/ussd/ussd_test], [], [expout], [ignore])
AT_CLEANUP
diff --git a/tests/ussd/ussd_test.c b/tests/ussd/ussd_test.c
index 6d2a8c9b..55384f10 100644
--- a/tests/ussd/ussd_test.c
+++ b/tests/ussd/ussd_test.c
@@ -19,6 +19,8 @@
*
*/
+#include <osmocom/core/application.h>
+#include <osmocom/core/logging.h>
#include <osmocom/gsm/gsm0480.h>
#include <stdio.h>
#include <stdlib.h>
@@ -64,12 +66,16 @@ static int parse_mangle_ussd(const uint8_t *_data, int len)
return rc;
}
+struct log_info info = {};
+
int main(int argc, char **argv)
{
struct ussd_request req;
const int size = sizeof(ussd_request);
int i;
+ osmo_init_logging(&info);
+
gsm0480_decode_ussd_request((struct gsm48_hdr *) ussd_request, size, &req);
printf("Tested if it still works. Text was: %s\n", req.text);
diff --git a/tests/ussd/ussd_test.ok b/tests/ussd/ussd_test.ok
index e4bfabc1..1b6316e8 100644
--- a/tests/ussd/ussd_test.ok
+++ b/tests/ussd/ussd_test.ok
@@ -1 +1,53 @@
-TODO: test is crashing inside the log handling
+Tested if it still works. Text was: **321#
+Testing parsing a USSD request and truncated versions
+Result for 1 is 28
+Result for 1 is 27
+Result for 1 is 26
+Result for 1 is 25
+Result for 0 is 24
+Result for 0 is 23
+Result for 0 is 22
+Result for 0 is 21
+Result for 0 is 20
+Result for 0 is 19
+Result for 0 is 18
+Result for 0 is 17
+Result for 0 is 16
+Result for 0 is 15
+Result for 0 is 14
+Result for 0 is 13
+Result for 0 is 12
+Result for 0 is 11
+Result for 0 is 10
+Result for 0 is 9
+Result for 0 is 8
+Result for 0 is 7
+Result for 0 is 6
+Result for 0 is 5
+Result for 0 is 4
+Result for 0 is 3
+Mangling the container now
+Result for 0 is 28
+Result for 0 is 27
+Result for 1 is 26
+Result for 1 is 25
+Result for 0 is 24
+Result for 0 is 23
+Result for 0 is 22
+Result for 0 is 21
+Result for 0 is 20
+Result for 0 is 19
+Result for 0 is 18
+Result for 0 is 17
+Result for 0 is 16
+Result for 0 is 15
+Result for 0 is 14
+Result for 0 is 13
+Result for 0 is 12
+Result for 0 is 11
+Result for 0 is 10
+Result for 0 is 9
+Result for 0 is 8
+Result for 0 is 7
+Result for 0 is 6
+Result for 1 is 5