• Home
  • Raw
  • Download

Lines Matching +full:fossilize +full:- +full:test

41 #include "util/mesa-sha1.h"
66 * This is equivalent to "rm -rf <dir>" with one bit of protection
70 * Returns 0 on success, -1 on any error.
76 return -1; in rmrf_local()
90 if (stat(full_path, &sb) != -1 && S_ISDIR(sb.st_mode)) in check_directories_created()
116 char data[] = "some test data"; in cache_exists()
149 #define CACHE_TEST_TMP "./cache-test-tmp"
159 * MESA_SHADER_CACHE_DISABLE set to true, that disk_cache_create returns NO-OP cache. in test_disk_cache_create()
162 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
163 … EXPECT_EQ(cache->type, DISK_CACHE_NONE) << "disk_cache_create with MESA_SHADER_CACHE_DISABLE set"; in test_disk_cache_create()
170 * MESA_SHADER_CACHE_DISABLE set to nothing, disk_cache_create returns NO-OP cache. in test_disk_cache_create()
173 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
174 EXPECT_EQ(cache->type, DISK_CACHE_NONE) in test_disk_cache_create()
184 * variables to test creation of cache in home directory. in test_disk_cache_create()
189 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
201 /* Test with XDG_CACHE_HOME set */ in test_disk_cache_create()
202 setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1); in test_disk_cache_create()
203 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
205 << "disk_cache_create with XDG_CACHE_HOME set with a non-existing parent directory"; in test_disk_cache_create()
214 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
219 mem_ctx, "%s%s", CACHE_TEST_TMP "/xdg-cache-home/", cache_dir_name); in test_disk_cache_create()
224 /* Test with MESA_SHADER_CACHE_DIR set */ in test_disk_cache_create()
228 setenv("MESA_SHADER_CACHE_DIR", CACHE_TEST_TMP "/mesa-shader-cache-dir", 1); in test_disk_cache_create()
229 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
231 << "disk_cache_create with MESA_SHADER_CACHE_DIR set with a non-existing parent directory"; in test_disk_cache_create()
243 cache = disk_cache_create("test", driver_id, 0); in test_disk_cache_create()
247 mem_ctx, "%s%s", CACHE_TEST_TMP "/mesa-shader-cache-dir/", cache_dir_name); in test_disk_cache_create()
257 char blob[] = "This is a blob of thirty-seven bytes"; in test_put_and_get()
259 char string[] = "While this string has thirty-four"; in test_put_and_get()
271 cache = disk_cache_create("test", driver_id, 0); in test_put_and_get()
277 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in test_put_and_get()
278 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in test_put_and_get()
280 /* Simple test of put and get. */ in test_put_and_get()
292 /* Test put and get of a second item. */ in test_put_and_get()
312 cache = disk_cache_create("test", driver_id, 0); in test_put_and_get()
316 /* Obviously the SHA-1 hash of 1024 zero bytes isn't particularly in test_put_and_get()
330 * For this test, we force this signature to land in the same in test_put_and_get()
375 cache = disk_cache_create("test", driver_id, 0); in test_put_and_get()
449 cache = disk_cache_create("test", driver_id, 0); in test_put_key_and_get_key()
451 /* First test that disk_cache_has_key returns false before disk_cache_put_key */ in test_put_key_and_get_key()
464 /* Test that a key with the same two bytes as an existing key in test_put_key_and_get_key()
474 /* And finally test that we can re-add the original key to re-evict in test_put_key_and_get_key()
488 * file cache we test adding and retriving cache items between two different
494 char blob[] = "This is a blob of thirty-seven bytes"; in test_put_and_get_between_instances()
496 char string[] = "While this string has thirty-four"; in test_put_and_get_between_instances()
514 EXPECT_EQ(result, nullptr) << "disk_cache_get(cache1) with non-existent item (pointer)"; in test_put_and_get_between_instances()
515 EXPECT_EQ(size, 0) << "disk_cache_get(cach1) with non-existent item (size)"; in test_put_and_get_between_instances()
518 EXPECT_EQ(result, nullptr) << "disk_cache_get(cache2) with non-existent item (pointer)"; in test_put_and_get_between_instances()
519 EXPECT_EQ(size, 0) << "disk_cache_get(cache2) with non-existent item (size)"; in test_put_and_get_between_instances()
521 /* Simple test of put and get. */ in test_put_and_get_between_instances()
533 /* Test put and get of a second item, via the opposite instances */ in test_put_and_get_between_instances()
578 size_big -= sizeof(struct cache_entry_file_data); in test_put_and_get_between_instances_with_eviction()
579 size_big -= mesa_cache_db_file_entry_size(); in test_put_and_get_between_instances_with_eviction()
580 size_big -= cache[0]->driver_keys_blob_size; in test_put_and_get_between_instances_with_eviction()
581 size_big -= 4 + 8; /* cache_item_metadata size + room for alignment */ in test_put_and_get_between_instances_with_eviction()
600 size_small -= sizeof(struct cache_entry_file_data); in test_put_and_get_between_instances_with_eviction()
601 size_small -= mesa_cache_db_file_entry_size(); in test_put_and_get_between_instances_with_eviction()
602 size_small -= cache[1]->driver_keys_blob_size; in test_put_and_get_between_instances_with_eviction()
603 size_small -= 4 + 8; /* cache_item_metadata size + room for alignment */ in test_put_and_get_between_instances_with_eviction()
623 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in test_put_and_get_between_instances_with_eviction()
624 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in test_put_and_get_between_instances_with_eviction()
628 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in test_put_and_get_between_instances_with_eviction()
629 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in test_put_and_get_between_instances_with_eviction()
674 EXPECT_EQ(i, 10) << "2x disk_cache_get with 5 non-existent 256KB items"; in test_put_and_get_between_instances_with_eviction()
681 class Cache : public ::testing::Test {
777 * data much better than the multi-file cache, which results in the in TEST_F()
778 * failing tests of the cache eviction function. We we will test the in TEST_F()
829 /* Enable Fossilize read-write cache. */ in TEST_F()
834 /* Create Fossilize writable cache. */ in TEST_F()
843 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
844 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
855 /* Rename file foz_cache.foz -> ro_cache.foz */ in TEST_F()
856 sprintf(foz_rw_file, "%s/foz_cache.foz", cache_sf_wr->path); in TEST_F()
857 sprintf(foz_ro_file, "%s/ro_cache.foz", cache_sf_wr->path); in TEST_F()
860 /* Rename file foz_cache_idx.foz -> ro_cache_idx.foz */ in TEST_F()
861 sprintf(foz_rw_idx_file, "%s/foz_cache_idx.foz", cache_sf_wr->path); in TEST_F()
862 sprintf(foz_ro_idx_file, "%s/ro_cache_idx.foz", cache_sf_wr->path); in TEST_F()
867 /* Disable Fossilize read-write cache. */ in TEST_F()
870 /* Set up Fossilize read-only cache. */ in TEST_F()
895 /* Create MESA-DB cache with enabled retrieval from the read-only in TEST_F()
901 * reloads index if cache entry is missing. This is a sanity-check in TEST_F()
905 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
906 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
909 * read-only cache. */ in TEST_F()
917 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
918 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
925 * read-write cache. */ in TEST_F()
933 /* Disable read-only cache. */ in TEST_F()
936 /* Create MESA-DB cache with disabled retrieval from the in TEST_F()
937 * read-only cache. */ in TEST_F()
941 * MESA-DB cache. */ in TEST_F()
949 /* Create MESA-DB cache with disabled retrieval from the read-only in TEST_F()
954 * read-only cache. */ in TEST_F()
956 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
957 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
961 /* Create default multi-file cache. */ in TEST_F()
964 /* Enable read-only cache. */ in TEST_F()
967 /* Create multi-file cache with enabled retrieval from the in TEST_F()
968 * read-only cache. */ in TEST_F()
973 * read-only cache. */ in TEST_F()
981 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
982 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
989 * read-write cache. */ in TEST_F()
997 /* Disable read-only cache. */ in TEST_F()
1001 /* Create multi-file cache with disabled retrieval from the in TEST_F()
1002 * read-only cache. */ in TEST_F()
1006 * read-only cache. */ in TEST_F()
1008 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
1009 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
1012 * read-write cache. */ in TEST_F()
1052 /* Create Fossilize writable cache. */ in TEST_F()
1061 << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
1062 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
1073 /* Rename file foz_cache.foz -> ro_cache.foz */ in TEST_F()
1074 sprintf(foz_rw_file, "%s/foz_cache.foz", cache_sf_wr->path); in TEST_F()
1075 sprintf(foz_ro_file, "%s/ro_cache.foz", cache_sf_wr->path); in TEST_F()
1079 /* Rename file foz_cache_idx.foz -> ro_cache_idx.foz */ in TEST_F()
1080 sprintf(foz_rw_idx_file, "%s/foz_cache_idx.foz", cache_sf_wr->path); in TEST_F()
1081 sprintf(foz_ro_idx_file, "%s/ro_cache_idx.foz", cache_sf_wr->path); in TEST_F()
1095 /* Create Fossilize writable cache. */ in TEST_F()
1108 /* Test loading from a list populated at runtime */ in TEST_F()
1113 /* Create Fossilize writable cache. */ in TEST_F()
1119 << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
1120 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
1139 /* Test loading from a list with some invalid files */ in TEST_F()
1144 /* Create Fossilize writable cache. */ in TEST_F()
1150 << "disk_cache_get with non-existent item (pointer)"; in TEST_F()
1151 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in TEST_F()
1153 /* Add non-existant list files for loading */ in TEST_F()
1197 struct disk_cache *cache = disk_cache_create("test", driver_id, 0); in test_multipart_eviction()
1200 entry_file_size -= sizeof(struct cache_entry_file_data); in test_multipart_eviction()
1201 entry_file_size -= mesa_cache_db_file_entry_size(); in test_multipart_eviction()
1202 entry_file_size -= cache->driver_keys_blob_size; in test_multipart_eviction()
1203 entry_file_size -= 4 + 8; /* cache_item_metadata size + room for alignment */ in test_multipart_eviction()
1253 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in test_multipart_eviction()
1290 char blob[] = "This is a blob of thirty-seven bytes"; in test_put_and_get_disabled()
1295 cache = disk_cache_create("test", driver_id, 0); in test_put_and_get_disabled()
1301 EXPECT_EQ(result, nullptr) << "disk_cache_get with non-existent item (pointer)"; in test_put_and_get_disabled()
1302 EXPECT_EQ(size, 0) << "disk_cache_get with non-existent item (size)"; in test_put_and_get_disabled()
1304 /* Simple test of put and get. */ in test_put_and_get_disabled()