util/disk_cache: fix make check
Fixes make check after 11f0efec2e
which caused disk cache
to create an additional directory.
This commit is contained in:
@@ -127,7 +127,7 @@ rmrf_local(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_timestamp_and_gpu_id_directories_created(const char *cache_dir)
|
check_timestamp_and_gpu_id_directories_created(char *cache_dir)
|
||||||
{
|
{
|
||||||
bool sub_dirs_created = false;
|
bool sub_dirs_created = false;
|
||||||
|
|
||||||
@@ -180,13 +180,16 @@ test_disk_cache_create(void)
|
|||||||
expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set with"
|
expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set with"
|
||||||
"a non-existing parent directory");
|
"a non-existing parent directory");
|
||||||
|
|
||||||
|
/* Create string with expected directory hierarchy */
|
||||||
|
char expected_dir_h[255];
|
||||||
|
sprintf(expected_dir_h, "%s%s%s", CACHE_TEST_TMP "/xdg-cache-home/mesa/",
|
||||||
|
get_arch_bitness_str(), "/make_check/test");
|
||||||
|
|
||||||
mkdir(CACHE_TEST_TMP, 0755);
|
mkdir(CACHE_TEST_TMP, 0755);
|
||||||
cache = disk_cache_create("test", "make_check");
|
cache = disk_cache_create("test", "make_check");
|
||||||
expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME set");
|
expect_non_null(cache, "disk_cache_create with XDG_CACHE_HOME set");
|
||||||
|
|
||||||
check_timestamp_and_gpu_id_directories_created(CACHE_TEST_TMP
|
check_timestamp_and_gpu_id_directories_created(expected_dir_h);
|
||||||
"/xdg-cache-home"
|
|
||||||
"/mesa/make_check/test");
|
|
||||||
|
|
||||||
disk_cache_destroy(cache);
|
disk_cache_destroy(cache);
|
||||||
|
|
||||||
@@ -199,13 +202,15 @@ test_disk_cache_create(void)
|
|||||||
expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set with"
|
expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set with"
|
||||||
"a non-existing parent directory");
|
"a non-existing parent directory");
|
||||||
|
|
||||||
|
sprintf(expected_dir_h, "%s%s%s", CACHE_TEST_TMP
|
||||||
|
"/mesa-glsl-cache-dir/mesa/", get_arch_bitness_str(),
|
||||||
|
"/make_check/test");
|
||||||
|
|
||||||
mkdir(CACHE_TEST_TMP, 0755);
|
mkdir(CACHE_TEST_TMP, 0755);
|
||||||
cache = disk_cache_create("test", "make_check");
|
cache = disk_cache_create("test", "make_check");
|
||||||
expect_non_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set");
|
expect_non_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR set");
|
||||||
|
|
||||||
check_timestamp_and_gpu_id_directories_created(CACHE_TEST_TMP
|
check_timestamp_and_gpu_id_directories_created(expected_dir_h);
|
||||||
"/mesa-glsl-cache-dir"
|
|
||||||
"/mesa/make_check/test");
|
|
||||||
|
|
||||||
disk_cache_destroy(cache);
|
disk_cache_destroy(cache);
|
||||||
}
|
}
|
||||||
|
@@ -74,23 +74,6 @@ struct disk_cache {
|
|||||||
uint64_t max_size;
|
uint64_t max_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_arch_bitness_str(void)
|
|
||||||
{
|
|
||||||
if (sizeof(void *) == 4)
|
|
||||||
#ifdef __ILP32__
|
|
||||||
return "ilp-32";
|
|
||||||
#else
|
|
||||||
return "32";
|
|
||||||
#endif
|
|
||||||
if (sizeof(void *) == 8)
|
|
||||||
return "64";
|
|
||||||
|
|
||||||
/* paranoia check which will be dropped by the optimiser */
|
|
||||||
assert(!"unknown_arch");
|
|
||||||
return "unknown_arch";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a directory named 'path' if it does not already exist.
|
/* Create a directory named 'path' if it does not already exist.
|
||||||
*
|
*
|
||||||
* Returns: 0 if path already exists as a directory or if created.
|
* Returns: 0 if path already exists as a directory or if created.
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#ifdef ENABLE_SHADER_CACHE
|
#ifdef ENABLE_SHADER_CACHE
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -42,6 +43,23 @@ typedef uint8_t cache_key[CACHE_KEY_SIZE];
|
|||||||
|
|
||||||
struct disk_cache;
|
struct disk_cache;
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
get_arch_bitness_str(void)
|
||||||
|
{
|
||||||
|
if (sizeof(void *) == 4)
|
||||||
|
#ifdef __ILP32__
|
||||||
|
return "ilp-32";
|
||||||
|
#else
|
||||||
|
return "32";
|
||||||
|
#endif
|
||||||
|
if (sizeof(void *) == 8)
|
||||||
|
return "64";
|
||||||
|
|
||||||
|
/* paranoia check which will be dropped by the optimiser */
|
||||||
|
assert(!"unknown_arch");
|
||||||
|
return "unknown_arch";
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
|
disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user