[BlueZ, v4 9/9] unit: Add convert_sdp_record_to_xml() to SDP XML testing

Bastien Nocera <[email protected]>
Newsgroups org.kernel.vger.linux-bluetooth
Message-ID <[email protected]>
This tests SDP binary to XML conversion, including whether a fix for
a stack overflow when dealing with large sequences, like in
sequence_on_squared(), works correctly.
---
 unit/test-sdp-xml.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/unit/test-sdp-xml.c b/unit/test-sdp-xml.c
index 5aa98334eabc..b338788aa295 100644
--- a/unit/test-sdp-xml.c
+++ b/unit/test-sdp-xml.c
@@ -28,6 +28,12 @@ struct test_data {
 	gboolean expected_result;
 };
 
+static void doprintf(void *data, const char *str)
+{
+	/* Do nothing for our tests */
+	/* printf("%s", str); */
+}
+
 static void parse_xml(gconstpointer data, gsize len, gboolean expected_result)
 {
 	sdp_record_t *rec = NULL;
@@ -39,8 +45,10 @@ static void parse_xml(gconstpointer data, gsize len, gboolean expected_result)
 		tester_test_passed();
 	else
 		tester_test_failed();
-	if (rec)
+	if (rec) {
+		convert_sdp_record_to_xml(rec, 0, doprintf);
 		sdp_record_free(rec);
+	}
 }
 
 static void parse_xml_for_filename(gconstpointer data)
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.