]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
torture: Use SINGLETON_CACHE_TALLOC in tests
authorVolker Lendecke <vl@samba.org>
Mon, 16 Feb 2026 16:38:02 +0000 (17:38 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 1 Mar 2026 20:19:35 +0000 (20:19 +0000)
GETWD_CACHE is on its way out. Despite not having _TALLOC in its name
nor it being marked as talloc in memcache.h, memcache_is_talloc()
shows it as being talloc'ed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
lib/util/tests/test_memcache.c
source3/torture/torture.c

index 8a3997817c11281ce3f840121ed6bb5fd51ecec5..3de17f5a19f50b753137ad966548c2ec00dd327f 100644 (file)
@@ -76,26 +76,26 @@ static void torture_memcache_add_lookup_delete(void **state)
        path2 = talloc_strdup(mem_ctx, "/tmp/two");
        assert_non_null(path1);
 
-       memcache_add_talloc(cache, GETWD_CACHE, key1, &path1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key1, &path1);
        assert_null(path1);
 
-       memcache_add_talloc(cache, GETWD_CACHE, key2, &path2);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key2, &path2);
        assert_null(path2);
 
-       path1 = memcache_lookup_talloc(cache, GETWD_CACHE, key1);
+       path1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key1);
        assert_non_null(path1);
        assert_string_equal(path1, "/tmp/one");
 
-       path2 = memcache_lookup_talloc(cache, GETWD_CACHE, key2);
+       path2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key2);
        assert_non_null(path2);
        assert_string_equal(path2, "/tmp/two");
 
-       memcache_delete(cache, GETWD_CACHE, key1);
-       path1 = memcache_lookup_talloc(cache, GETWD_CACHE, key1);
+       memcache_delete(cache, SINGLETON_CACHE_TALLOC, key1);
+       path1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key1);
        assert_null(path1);
 
-       memcache_flush(cache, GETWD_CACHE);
-       path2 = memcache_lookup_talloc(cache, GETWD_CACHE, key2);
+       memcache_flush(cache, SINGLETON_CACHE_TALLOC);
+       path2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key2);
        assert_null(path2);
 
        TALLOC_FREE(path1);
@@ -121,16 +121,16 @@ static void torture_memcache_add_oversize(void **state)
        path2 = talloc_strdup(mem_ctx, "/tmp/two");
        assert_non_null(path1);
 
-       memcache_add_talloc(cache, GETWD_CACHE, key1, &path1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key1, &path1);
        assert_null(path1);
 
-       memcache_add_talloc(cache, GETWD_CACHE, key2, &path2);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key2, &path2);
        assert_null(path2);
 
-       path1 = memcache_lookup_talloc(cache, GETWD_CACHE, key1);
+       path1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key1);
        assert_null(path1);
 
-       path2 = memcache_lookup_talloc(cache, GETWD_CACHE, key2);
+       path2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key2);
        assert_non_null(path2);
        assert_string_equal(path2, "/tmp/two");
 
index 6d2a719144f4eafcd230a385c65287a36d4a9e49..60176f7116bfb21158459b78c6837f0ac21fed00 100644 (file)
@@ -14346,7 +14346,7 @@ static bool run_local_memcache(int dummy)
 
        TALLOC_FREE(cache);
 
-       /* GETWD_CACHE TESTS */
+       /* SINGLETON_CACHE_TALLOC TESTS */
        str1 = talloc_strdup(mem_ctx, "string1");
        if (str1 == NULL) {
                return false;
@@ -14364,9 +14364,9 @@ static bool run_local_memcache(int dummy)
                return false;
        }
 
-       memcache_add_talloc(cache, GETWD_CACHE, k2, &str1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k2, &str1);
        /* str1 == NULL now. */
-       ptr1 = memcache_lookup_talloc(cache, GETWD_CACHE, k2);
+       ptr1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k2);
        if (ptr1 == NULL) {
                printf("could not find k2\n");
                return false;
@@ -14380,7 +14380,7 @@ static bool run_local_memcache(int dummy)
        d3 = data_blob_talloc_zero(mem_ctx, 180);
        memcache_add(cache, STAT_CACHE, k3, d3);
 
-       ptr2 = memcache_lookup_talloc(cache, GETWD_CACHE, k2);
+       ptr2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k2);
        if (ptr2 != NULL) {
                printf("Did find k2, should have been purged\n");
                return false;
@@ -14394,10 +14394,10 @@ static bool run_local_memcache(int dummy)
        str1 = talloc_zero_size(mem_ctx, 100);
        str2 = talloc_zero_size(mem_ctx, 100);
 
-       memcache_add_talloc(cache, GETWD_CACHE, k4, &str1);
-       memcache_add_talloc(cache, GETWD_CACHE, k5, &str1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k4, &str1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k5, &str1);
 
-       ptr3 = memcache_lookup_talloc(cache, GETWD_CACHE, k4);
+       ptr3 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k4);
        if (ptr3 != NULL) {
                printf("Did find k4, should have been purged\n");
                return false;
@@ -14427,7 +14427,7 @@ static bool run_local_memcache(int dummy)
         * total talloced size.
         */
        str1 = talloc_zero_size(mem_ctx, 100);
-       memcache_add_talloc(cache, GETWD_CACHE, k4, &str1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k4, &str1);
        /*
         * Now overwrite with a small talloced
         * value. This should fit in the existing size
@@ -14435,7 +14435,7 @@ static bool run_local_memcache(int dummy)
         * from the cache size.
         */
        str1 = talloc_zero_size(mem_ctx, 2);
-       memcache_add_talloc(cache, GETWD_CACHE, k4, &str1);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k4, &str1);
        /*
         * Now store a 20 byte string. If the
         * total talloced size wasn't accounted for
@@ -14443,9 +14443,9 @@ static bool run_local_memcache(int dummy)
         * will evict k4.
         */
        str2 = talloc_zero_size(mem_ctx, 20);
-       memcache_add_talloc(cache, GETWD_CACHE, k5, &str2);
+       memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k5, &str2);
 
-       ptr3 = memcache_lookup_talloc(cache, GETWD_CACHE, k4);
+       ptr3 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k4);
        if (ptr3 == NULL) {
                printf("Did not find k4, should not have been purged\n");
                return false;