From f73a5772c0320a7f56eda51a6449d1fc509ac397 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 2 Apr 2025 13:02:02 -0400 Subject: [PATCH] MT#55283 remove timestamp from DTMF tests Not deterministic Change-Id: Iad2baa3dbbf57a7dd77db972542fe0613263c5c8 --- t/test-transcode.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/t/test-transcode.c b/t/test-transcode.c index 47dbadd38..09e44a2df 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -395,6 +395,16 @@ static void dtmf(const char *s) { abort(); return; } + // remove "timestamp":xxx, + char *p = memmem(dtmf_logs->str, dtmf_logs->len, "\"timestamp\":", 12); + if (p) { + size_t pos = p - dtmf_logs->str; + g_string_erase(dtmf_logs, pos, 12); + // remove digits and trailing ',' + while ((dtmf_logs->str[pos] >= '0' && dtmf_logs->str[pos] <= '9') + || dtmf_logs->str[pos] == ',') + g_string_erase(dtmf_logs, pos, 1); + } if (strlen(s) != dtmf_logs->len) { printf("DTMF mismatch: \"%s\" != \"%s\"\n", s, dtmf_logs->str); abort(); @@ -796,7 +806,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); dtmf(""); @@ -812,7 +822,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80", 0); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80", 0); dtmf(""); @@ -845,7 +855,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); dtmf(""); @@ -861,7 +871,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80", 0); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80", 0); dtmf(""); @@ -893,7 +903,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); dtmf(""); @@ -909,7 +919,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80", 0); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, 101, "\x05\x8a\x02\x80", 0); dtmf(""); @@ -941,7 +951,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); dtmf(""); @@ -959,7 +969,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, ""); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, "", 0); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, "", 0); dtmf(""); @@ -1006,7 +1016,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); dtmf(""); @@ -1024,7 +1034,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, ""); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, "", 0); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, "", 0); dtmf(""); @@ -1070,7 +1080,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20"); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":8,\"duration\":100,\"volume\":10}"); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); packet_seq_exp(A, 101, "\x08\x8a\x03\x20", 1000160, 205, 101, "\x08\x8a\x03\x20", 0); dtmf(""); @@ -1088,7 +1098,7 @@ int main(void) { dtmf(""); // end packet_seq(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, ""); - dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"timestamp\":0,\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); + dtmf("{\"callid\":\"test-call\",\"source_tag\":\"tag_A\",\"source_label\":\"label_A\",\"tags\":[],\"type\":\"DTMF\",\"source_ip\":\"\",\"event\":5,\"duration\":80,\"volume\":10}"); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, "", 0); packet_seq_exp(A, 101, "\x05\x8a\x02\x80", 1001280, 211, -1, "", 0); dtmf("");