@@ -1311,6 +1311,40 @@ void packet_test_copydata(void)
odp_packet_free(pkt);
}
+void packet_test_setcmpdata(void)
+{
+ odp_packet_t pkt = test_packet;
+ uint32_t pkt_len = odp_packet_len(pkt);
+ uint8_t *data_buf;
+ uint32_t i;
+ int correct_memory;
+
+ CU_ASSERT_FATAL(pkt_len > 0);
+
+ data_buf = malloc(pkt_len);
+ CU_ASSERT_PTR_NOT_NULL_FATAL(data_buf);
+
+ CU_ASSERT(!odp_packet_set_data(pkt, 0, 0xa5, pkt_len));
+ memset(data_buf, 0, pkt_len);
+ CU_ASSERT(!odp_packet_copy_to_mem(pkt, 0, pkt_len, data_buf));
+
+ correct_memory = 1;
+ for (i = 0; i < pkt_len; i++)
+ if (data_buf[i] != 0xa5) {
+ correct_memory = 0;
+ break;
+ }
+ CU_ASSERT(correct_memory);
+
+ CU_ASSERT(!odp_packet_cmp_mem(pkt, 0, data_buf, pkt_len));
+
+ data_buf[pkt_len - 1] = 0x5a;
+
+ CU_ASSERT(odp_packet_cmp_mem(pkt, 0, data_buf, pkt_len));
+
+ free(data_buf);
+}
+
void packet_test_concatsplit(void)
{
odp_packet_t pkt, pkt2;
@@ -2431,6 +2465,7 @@ odp_testinfo_t packet_suite[] = {
ODP_TEST_INFO(packet_test_add_rem_data),
ODP_TEST_INFO(packet_test_copy),
ODP_TEST_INFO(packet_test_copydata),
+ ODP_TEST_INFO(packet_test_setcmpdata),
ODP_TEST_INFO(packet_test_concatsplit),
ODP_TEST_INFO(packet_test_concat_small),
ODP_TEST_INFO(packet_test_concat_extend_trunc),
@@ -29,6 +29,7 @@ void packet_test_error_flags(void);
void packet_test_add_rem_data(void);
void packet_test_copy(void);
void packet_test_copydata(void);
+void packet_test_setcmpdata(void);
void packet_test_concatsplit(void);
void packet_test_concat_small(void);
void packet_test_concat_extend_trunc(void);