From: Jason Ekstrand Date: Wed, 16 Sep 2015 04:37:01 +0000 (-0700) Subject: anv/tests: Add some asserts for data integrity in block_pool_no_free X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dcf424c98cf32597e83cbc87eb5d62909a5bf481;p=mesa.git anv/tests: Add some asserts for data integrity in block_pool_no_free --- diff --git a/src/vulkan/tests/block_pool_no_free.c b/src/vulkan/tests/block_pool_no_free.c index 01c23e21b2d..86d1a76151f 100644 --- a/src/vulkan/tests/block_pool_no_free.c +++ b/src/vulkan/tests/block_pool_no_free.c @@ -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;