From dcf424c98cf32597e83cbc87eb5d62909a5bf481 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 15 Sep 2015 21:37:01 -0700 Subject: anv/tests: Add some asserts for data integrity in block_pool_no_free --- src/vulkan/tests/block_pool_no_free.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/vulkan/tests') 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; -- cgit v1.2.3