util/cache_test: Fix disabled cache test using SHADER_CACHE_DISABLE_BY_DEFAULT

Previous commit decoupled EGL_ANDROID_blob_cache from the disk cache
and haven't updated the SHADER_CACHE_DISABLE_BY_DEFAULT test-case that
is failing because now cache is always created even if disk cache is
disabled, such cache is NO-OP in this case. Fix the failing 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:13:11 +03:00
committed by Marge Bot
parent 976fe1d77c
commit 4547671fc3
+3 -2
View File
@@ -166,13 +166,14 @@ test_disk_cache_create(void *mem_ctx, const char *cache_dir_name,
#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.
* MESA_SHADER_CACHE_DISABLE set to nothing, disk_cache_create returns NO-OP cache.
*/
unsetenv("MESA_SHADER_CACHE_DISABLE");
cache = disk_cache_create("test", driver_id, 0);
EXPECT_EQ(cache, nullptr)
EXPECT_EQ(cache->type, DISK_CACHE_NONE)
<< "disk_cache_create with MESA_SHADER_CACHE_DISABLE unset "
"and SHADER_CACHE_DISABLE_BY_DEFAULT build option";
disk_cache_destroy(cache);
/* For remaining tests, ensure that the cache is enabled. */
setenv("MESA_SHADER_CACHE_DISABLE", "false", 1);