Petri Savolainen(psavol) replied on github web page:

test/validation/api/pool/pool.c
line 40
@@ -217,6 +217,50 @@ static void pool_test_info_packet(void)
        CU_ASSERT(odp_pool_destroy(pool) == 0);
 }
 
+static void pool_test_info_data_range(void)
+{
+       odp_pool_t pool;
+       odp_pool_info_t info;
+       odp_pool_param_t param;
+       odp_packet_t pkt[PKT_NUM];
+       uint32_t i, num;
+       uintptr_t pkt_data, pool_len;
+
+       odp_pool_param_init(&param);
+
+       param.type     = ODP_POOL_PACKET;
+       param.pkt.num  = PKT_NUM;
+       param.pkt.len  = PKT_LEN;
+
+       pool = odp_pool_create(NULL, &param);
+       CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
+
+       CU_ASSERT_FATAL(odp_pool_info(pool, &info) == 0);
+
+       pool_len = info.max_data_addr - info.min_data_addr + 1;
+       CU_ASSERT(pool_len >= PKT_NUM * PKT_LEN);
+
+       num = 0;
+
+       for (i = 0; i < PKT_NUM; i++) {
+               pkt[num] = odp_packet_alloc(pool, PKT_LEN);
+               CU_ASSERT(pkt[num] != ODP_PACKET_INVALID);
+
+               if (pkt[num] != ODP_PACKET_INVALID)
+                       num++;
+       }
+
+       for (i = 0; i < num; i++) {
+               pkt_data = (uintptr_t)odp_packet_data(pkt[i]);
+               CU_ASSERT((pkt_data >= info.min_data_addr) &&
+                         (pkt_data + PKT_LEN - 1 <= info.max_data_addr));


Comment:
It wrong to assume that entire packet data follows data pointer. Use 
odp_packet_seg_len() instead of PKT_LEN here.

> semihalf-mazur-michal wrote
> Fixed in v4


>> Bill Fischofer(Bill-Fischofer-Linaro) wrote:
>> I'd make this `CU_ASSERT()` rather than `CU_ASSERT_FATAL()` so all 
>> discrepancies can be caught. `CU_ASSERT_FATAL()` is reserved for setup 
>> failures that invalidate the entire test (_e.g.,_ not being able to create 
>> the pool, `odp_pool_info()` reporting an error, etc.)


https://github.com/Linaro/odp/pull/495#discussion_r170193779
updated_at 2018-02-23 08:43:57

Reply via email to