aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-11-20 10:47:14 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-11-20 10:47:14 +0100
commit475291355dc2c48dbde85559616dda415042ee13 (patch)
treed1d36a46f04a3e391cdb87f8a9f6ffca20191b57 /tests/mgcp
parentfd8513d8c398b08d0f4812b6df5a8fac7e629969 (diff)
tests: Add GNU Autotest invocation for the tests we have here
Add some std output of the applications, integrate tests.
Diffstat (limited to 'tests/mgcp')
-rw-r--r--tests/mgcp/Makefile.am2
-rw-r--r--tests/mgcp/mgcp_patch_test.c9
-rw-r--r--tests/mgcp/mgcp_patch_test.ok42
3 files changed, 49 insertions, 4 deletions
diff --git a/tests/mgcp/Makefile.am b/tests/mgcp/Makefile.am
index 2e8db48..008979b 100644
--- a/tests/mgcp/Makefile.am
+++ b/tests/mgcp/Makefile.am
@@ -2,5 +2,7 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS)
noinst_PROGRAMS = mgcp_patch_test
+EXTRA_DIST = mgcp_patch_test.ok
+
mgcp_patch_test_SOURCES = mgcp_patch_test.c $(top_srcdir)/src/mgcp_patch.c
mgcp_patch_test_LDADD = $(LIBOSMOCORE_LIBS)
diff --git a/tests/mgcp/mgcp_patch_test.c b/tests/mgcp/mgcp_patch_test.c
index 335cfcf..683ea01 100644
--- a/tests/mgcp/mgcp_patch_test.c
+++ b/tests/mgcp/mgcp_patch_test.c
@@ -71,8 +71,10 @@ static const char mgcp_out[] =
static void test_endp_name_rewriting()
{
struct ss7_application app;
- memset(&app, 0, sizeof(app));
+ printf("Test Endpoint Name rewriting.\n");
+
+ memset(&app, 0, sizeof(app));
app.mgcp_domain_name = "foo2";
/* prepare */
@@ -83,12 +85,10 @@ static void test_endp_name_rewriting()
/* patch it now */
struct msgb *msg_out = mgcp_patch(&app, msg);
msg_out->l2h[msgb_l2len(msg_out)] = '\0';
-#ifdef DEBUG
printf("Want : '%s'\n", mgcp_out);
printf("Outpu: '%s'\n", (const char *) msg_out->l2h);
- printf("%s\n", osmo_hexdump(mgcp_out, strlen(mgcp_out)));
+ printf("%s\n", osmo_hexdump((const uint8_t *) mgcp_out, strlen(mgcp_out)));
printf("%s\n", osmo_hexdump(msg_out->l2h, msgb_l2len(msg_out)));
-#endif
ASSERT(msg_out, !=, msg, "msg should not be the same");
ASSERT(msgb_l2len(msg_out), ==, strlen(mgcp_out), "Output size wrong");
@@ -99,5 +99,6 @@ int main(int argc, char **argv)
{
test_endp_name_rewriting();
+ printf("All tests passed.\n");
return 0;
}
diff --git a/tests/mgcp/mgcp_patch_test.ok b/tests/mgcp/mgcp_patch_test.ok
new file mode 100644
index 0000000..d59bd28
--- /dev/null
+++ b/tests/mgcp/mgcp_patch_test.ok
@@ -0,0 +1,42 @@
+Test Endpoint Name rewriting.
+Want : 'MDCX 23213 14@foo2 MGCP 1.0
+C: 4a84ad5d25f
+I: %d
+L: p:20, a:GSM-EFR, nt:IN
+M: recvonly
+
+v=0
+o=- 258696477 0 IN IP4 172.16.1.107
+s=-
+c=IN IP4 172.16.1.107
+t=0 0
+m=audio 6666 RTP/AVP 127
+a=rtpmap:127 GSM-EFR/8000/1
+a=ptime:20
+a=recvonly
+m=image 4402 udptl t38
+a=T38FaxVersion:0
+a=T38MaxBitRate:14400
+'
+Outpu: 'MDCX 23213 14@foo2 MGCP 1.0
+C: 4a84ad5d25f
+I: %d
+L: p:20, a:GSM-EFR, nt:IN
+M: recvonly
+
+v=0
+o=- 258696477 0 IN IP4 172.16.1.107
+s=-
+c=IN IP4 172.16.1.107
+t=0 0
+m=audio 6666 RTP/AVP 127
+a=rtpmap:127 GSM-EFR/8000/1
+a=ptime:20
+a=recvonly
+m=image 4402 udptl t38
+a=T38FaxVersion:0
+a=T38MaxBitRate:14400
+'
+4d 44 43 58 20 32 33 32 31 33 20 31 34 40 66 6f 6f 32 20 4d 47 43 50 20 31 2e 30 0d 0a 43 3a 20 34 61 38 34 61 64 35 64 32 35 66 0d 0a 49 3a 20 25 64 0d 0a 4c 3a 20 70 3a 32 30 2c 20 61 3a 47 53 4d 2d 45 46 52 2c 20 6e 74 3a 49 4e 0d 0a 4d 3a 20 72 65 63 76 6f 6e 6c 79 0d 0a 0d 0a 76 3d 30 0d 0a 6f 3d 2d 20 32 35 38 36 39 36 34 37 37 20 30 20 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 73 3d 2d 0d 0a 63 3d 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 74 3d 30 20 30 0d 0a 6d 3d 61 75 64 69 6f 20 36 36 36 36 20 52 54 50 2f 41 56 50 20 31 32 37 0d 0a 61 3d 72 74 70 6d 61 70 3a 31 32 37 20 47 53 4d 2d 45 46 52 2f 38 30 30 30 2f 31 0d 0a 61 3d 70 74 69 6d 65 3a 32 30 0d 0a 61 3d 72 65 63 76 6f 6e 6c 79 0d 0a 6d 3d 69 6d 61 67 65 20 34 34 30 32 20 75 64 70 74 6c 20 74 33 38 0d 0a 61 3d 54 33 38 46 61 78 56 65 72 73 69 6f 6e 3a 30 0d 0a 61 3d 54 33 38 4d 61 78 42 69 74 52 61 74 65 3a 31 34 34 30 30 0d 0a
+4d 44 43 58 20 32 33 32 31 33 20 31 34 40 66 6f 6f 32 20 4d 47 43 50 20 31 2e 30 0d 0a 43 3a 20 34 61 38 34 61 64 35 64 32 35 66 0d 0a 49 3a 20 25 64 0d 0a 4c 3a 20 70 3a 32 30 2c 20 61 3a 47 53 4d 2d 45 46 52 2c 20 6e 74 3a 49 4e 0d 0a 4d 3a 20 72 65 63 76 6f 6e 6c 79 0d 0a 0d 0a 76 3d 30 0d 0a 6f 3d 2d 20 32 35 38 36 39 36 34 37 37 20 30 20 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 73 3d 2d 0d 0a 63 3d 49 4e 20 49 50 34 20 31 37 32 2e 31 36 2e 31 2e 31 30 37 0d 0a 74 3d 30 20 30 0d 0a 6d 3d 61 75 64 69 6f 20 36 36 36 36 20 52 54 50 2f 41 56 50 20 31 32 37 0d 0a 61 3d 72 74 70 6d 61 70 3a 31 32 37 20 47 53 4d 2d 45 46 52 2f 38 30 30 30 2f 31 0d 0a 61 3d 70 74 69 6d 65 3a 32 30 0d 0a 61 3d 72 65 63 76 6f 6e 6c 79 0d 0a 6d 3d 69 6d 61 67 65 20 34 34 30 32 20 75 64 70 74 6c 20 74 33 38 0d 0a 61 3d 54 33 38 46 61 78 56 65 72 73 69 6f 6e 3a 30 0d 0a 61 3d 54 33 38 4d 61 78 42 69 74 52 61 74 65 3a 31 34 34 30 30 0d 0a
+All tests passed.