diff options
author | Eric Anholt <[email protected]> | 2020-03-10 14:52:42 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-12 19:47:23 +0000 |
commit | d0a52432b19f1d3e61b20a5dd4ba1a1e5546bd7d (patch) | |
tree | 180e36fe8a82041176055ab5847c4ab49919b464 /src/util | |
parent | e178bca5cc194ecb3e6b447620045a72f9cc465d (diff) |
glsl/tests: Fix waiting for disk_cache_put() to finish.
We were wasting 4s on waiting for expected-not-to-appear files to show
up on every test. Using timeouts in test code is error-prone anyway,
as our shared runners may be busy on other jobs.
Fixes: 50989f87e62e ("util/disk_cache: use a thread queue to write to shader cache")
Link: https://gitlab.freedesktop.org/mesa/mesa/issues/2505
Reviewed-by: Timothy Arceri <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4140>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4140>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/disk_cache.c | 6 | ||||
-rw-r--r-- | src/util/disk_cache.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index d1f14736725..74fc51b6305 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -455,6 +455,12 @@ disk_cache_destroy(struct disk_cache *cache) ralloc_free(cache); } +void +disk_cache_wait_for_idle(struct disk_cache *cache) +{ + util_queue_finish(&cache->cache_queue); +} + /* Return a filename within the cache's directory corresponding to 'key'. The * returned filename is ralloced with 'cache' as the parent context. * diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h index a77bb678b1a..09b316e6e8d 100644 --- a/src/util/disk_cache.h +++ b/src/util/disk_cache.h @@ -174,6 +174,12 @@ disk_cache_create(const char *gpu_name, const char *timestamp, void disk_cache_destroy(struct disk_cache *cache); +/* Wait for all previous disk_cache_put() calls to be processed (used for unit + * testing). + */ +void +disk_cache_wait_for_idle(struct disk_cache *cache); + /** * Remove the item in the cache under the name \key. */ |