diff --git a/src/dnslib/tests/realdata/dnslib/packet_tests_realdata.c b/src/dnslib/tests/realdata/dnslib/packet_tests_realdata.c
index 1045990ae5e3d8b52c0b201eb6e1f8491012988d..cfacdecd4a0e5fcaad11f5375d3aca77c5b14b7a 100644
--- a/src/dnslib/tests/realdata/dnslib/packet_tests_realdata.c
+++ b/src/dnslib/tests/realdata/dnslib/packet_tests_realdata.c
@@ -285,6 +285,7 @@ dnslib_packet_t *packet_from_test_response(test_response_t *test_packet)
 
 static int test_packet_parse_from_wire(list raw_response_list)
 {
+#ifdef TEST_WITH_LDNS
 	int errors = 0;
 
 	node *n = NULL;
@@ -328,10 +329,16 @@ static int test_packet_parse_from_wire(list raw_response_list)
 	}
 
 	return (errors == 0);
+#endif
+#ifndef TEST_WITH_LDNS
+	diag("Enable ldns to test this feature");
+	return 0;
+#endif
 }
 
 static int test_packet_to_wire(list raw_response_list)
 {
+#ifdef TEST_WITH_LDNS
 	int errors = 0;
 	/*!< \todo test queries too! */
 //	/* We'll need data from both lists. */
@@ -410,6 +417,11 @@ static int test_packet_to_wire(list raw_response_list)
 	}
 
 	return (errors == 0);
+#endif
+#ifndef TEST_WITH_LDNS
+	diag("Enable ldns to test this feature!");
+	return 0;
+#endif
 }
 
 static const uint DNSLIB_PACKET_TEST_COUNT = 2;