util/cache_test: Re-add test for disabled cache

Test for disabled cache was removed when we decoupled
EGL_ANDROID_blob_cache from the disk cache because test was failing
since it became outdated. Add the updated test.

Fixes: 39f26642 ("util: Decouple disk cache from EGL_ANDROID_blob_cache")
Reviewed-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24985>
This commit is contained in:
Dmitry Osipenko 2023-09-01 03:03:22 +03:00 committed by Marge Bot
parent 651c47f0ff
commit 976fe1d77c

View file

@ -154,6 +154,16 @@ test_disk_cache_create(void *mem_ctx, const char *cache_dir_name,
struct disk_cache *cache;
int err;
/* Before doing anything else, ensure that with
* MESA_SHADER_CACHE_DISABLE set to true, that disk_cache_create returns NO-OP cache.
*/
setenv("MESA_SHADER_CACHE_DISABLE", "true", 1);
cache = disk_cache_create("test", driver_id, 0);
EXPECT_EQ(cache->type, DISK_CACHE_NONE) << "disk_cache_create with MESA_SHADER_CACHE_DISABLE set";
disk_cache_destroy(cache);
unsetenv("MESA_SHADER_CACHE_DISABLE");
#ifdef SHADER_CACHE_DISABLE_BY_DEFAULT
/* With SHADER_CACHE_DISABLE_BY_DEFAULT, ensure that with
* MESA_SHADER_CACHE_DISABLE set to nothing, disk_cache_create returns NULL.