From 4547671fc3cb8611565fc4159562c1ab374ee0cf Mon Sep 17 00:00:00 2001 From: Dmitry Osipenko Date: Fri, 1 Sep 2023 03:13:11 +0300 Subject: [PATCH] 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 Signed-off-by: Dmitry Osipenko Part-of: --- src/util/tests/cache_test.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/tests/cache_test.cpp b/src/util/tests/cache_test.cpp index 1c3485f..c1900715 100644 --- a/src/util/tests/cache_test.cpp +++ b/src/util/tests/cache_test.cpp @@ -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); -- 2.7.4