torture3: Add a little gencache_parse load test
authorVolker Lendecke <vl@samba.org>
Mon, 10 Mar 2014 14:43:19 +0000 (15:43 +0100)
committerMichael Adam <obnox@samba.org>
Sat, 24 May 2014 14:16:43 +0000 (16:16 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Sat May 24 16:16:43 CEST 2014 on sn-devel-104

source3/torture/torture.c

index 95d8b333ecb9868dc12ae245a57116259a1fb650..cea908930c1e254478a28e43c40d79f5cfdaaac9 100644 (file)
@@ -8119,12 +8119,26 @@ static bool run_local_base64(int dummy)
        return ret;
 }
 
+static void parse_fn(time_t timeout, DATA_BLOB blob, void *private_data)
+{
+       return;
+}
+
 static bool run_local_gencache(int dummy)
 {
        char *val;
        time_t tm;
        DATA_BLOB blob;
        char v;
+       struct memcache *mem;
+       int i;
+
+       mem = memcache_init(NULL, 0);
+       if (mem == NULL) {
+               d_printf("%s: memcache_init failed\n", __location__);
+               return false;
+       }
+       memcache_set_global(mem);
 
        if (!gencache_set("foo", "bar", time(NULL) + 1000)) {
                d_printf("%s: gencache_set() failed\n", __location__);
@@ -8136,6 +8150,16 @@ static bool run_local_gencache(int dummy)
                return False;
        }
 
+       for (i=0; i<1000000; i++) {
+               gencache_parse("foo", parse_fn, NULL);
+       }
+
+       if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
+               d_printf("%s: gencache_get() failed\n", __location__);
+               return False;
+       }
+       TALLOC_FREE(val);
+
        if (!gencache_get("foo", talloc_tos(), &val, &tm)) {
                d_printf("%s: gencache_get() failed\n", __location__);
                return False;