anv/tests: Add some asserts for data integrity in block_pool_no_free
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 16 Sep 2015 04:37:01 +0000 (21:37 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 18 Sep 2015 00:44:20 +0000 (17:44 -0700)
src/vulkan/tests/block_pool_no_free.c

index 01c23e21b2dcdeea4219ae0ac15db82f9a3d8f31..86d1a76151f6c648d280336effaeea2b49ce0f42 100644 (file)
@@ -41,10 +41,30 @@ struct job {
 static void *alloc_blocks(void *_job)
 {
    struct job *job = _job;
+   int32_t block, *data;
 
    for (unsigned i = 0; i < BLOCKS_PER_THREAD; i++) {
-      job->blocks[i] = anv_block_pool_alloc(job->pool);
-      job->back_blocks[i] = -anv_block_pool_alloc_back(job->pool);
+      block = anv_block_pool_alloc(job->pool);
+      data = job->pool->map + block;
+      *data = block;
+      assert(block >= 0);
+      job->blocks[i] = block;
+
+      block = anv_block_pool_alloc_back(job->pool);
+      data = job->pool->map + block;
+      *data = block;
+      assert(block < 0);
+      job->back_blocks[i] = -block;
+   }
+
+   for (unsigned i = 0; i < BLOCKS_PER_THREAD; i++) {
+      block = job->blocks[i];
+      data = job->pool->map + block;
+      assert(*data == block);
+
+      block = -job->back_blocks[i];
+      data = job->pool->map + block;
+      assert(*data == block);
    }
 
    return NULL;