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.
diff --git a/openbsc/tests/mgcp/mgcp_transcoding_test.c b/openbsc/tests/mgcp/mgcp_transcoding_test.c
index 9cb1fda..6abf248 100644
--- a/openbsc/tests/mgcp/mgcp_transcoding_test.c
+++ b/openbsc/tests/mgcp/mgcp_transcoding_test.c
@@ -177,8 +177,10 @@
}
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 @@
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 @@
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 */