From 6041c8db271ec2a9eecba42763d23889b56267f4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 28 Jun 2014 13:24:36 +0200 Subject: [PATCH] mgcp: Do not use errx as finding a test failure is too hard It took me a long time to figure out that errx just exits and the test output didn't indicate that the application was exited early. Use a printf and good old abort in case of a failure. --- openbsc/tests/mgcp/mgcp_transcoding_test.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openbsc/tests/mgcp/mgcp_transcoding_test.c b/openbsc/tests/mgcp/mgcp_transcoding_test.c index 9cb1fdacb..6abf24892 100644 --- a/openbsc/tests/mgcp/mgcp_transcoding_test.c +++ b/openbsc/tests/mgcp/mgcp_transcoding_test.c @@ -177,8 +177,10 @@ static int given_configured_endpoint(int in_samples, int out_samples, } rc = mgcp_transcoding_setup(endp, dst_end, src_end); - if (rc < 0) - errx(1, "setup failed: %s", strerror(-rc)); + if (rc < 0) { + printf("setup failed: %s", strerror(-rc)); + abort(); + } *out_ctx = cfg; *out_endp = endp; @@ -217,8 +219,10 @@ static int transcode_test(const char *srcfmt, const char *dstfmt, cont = mgcp_transcoding_process_rtp(endp, dst_end, buf, &len, sizeof(buf)); - if (cont < 0) - errx(1, "processing failed: %s", strerror(-cont)); + if (cont < 0) { + printf("processing failed: %s", strerror(-cont)); + abort(); + } if (len < 24) { printf("encoded: %s\n", osmo_hexdump((unsigned char *)buf, len)); @@ -302,8 +306,10 @@ static int test_repacking(int in_samples, int out_samples, int no_transcode) break; } - if (cont < 0) - errx(1, "processing failed: %s", strerror(-cont)); + if (cont < 0) { + printf("processing failed: %s", strerror(-cont)); + abort(); + } len -= 12; /* ignore RTP header */