- ret &= test_ref1();
- ret &= test_ref2();
- ret &= test_ref3();
- ret &= test_ref4();
- ret &= test_unlink1();
- ret &= test_misc();
- ret &= test_realloc();
- ret &= test_realloc_child();
- ret &= test_steal();
- ret &= test_move();
- ret &= test_unref_reparent();
- ret &= test_realloc_fn();
- ret &= test_type();
- ret &= test_lifeless();
- ret &= test_loop();
- ret &= test_free_parent_deny_child();
- ret &= test_talloc_ptrtype();
- ret &= test_talloc_free_in_destructor();
- ret &= test_autofree();
+ ret &= test_ref1(tctx);
+ ret &= test_ref2(tctx);
+ ret &= test_ref3(tctx);
+ ret &= test_ref4(tctx);
+ ret &= test_unlink1(tctx);
+ ret &= test_misc(tctx);
+ ret &= test_realloc(tctx);
+ ret &= test_realloc_child(tctx);
+ ret &= test_steal(tctx);
+ ret &= test_move(tctx);
+ ret &= test_unref_reparent(tctx);
+ ret &= test_realloc_fn(tctx);
+ ret &= test_type(tctx);
+ ret &= test_lifeless(tctx);
+ ret &= test_loop(tctx);
+ ret &= test_free_parent_deny_child(tctx);
+ ret &= test_talloc_ptrtype(tctx);
+ ret &= test_talloc_free_in_destructor(tctx);
+ ret &= test_autofree(tctx);
+
+ return ret;
+}
+
+static int lock_failed = 0, unlock_failed = 0, lock_bad = 0;
+static int locked;
+
+#define MAX_ALLOCATIONS 100
+static void *allocations[MAX_ALLOCATIONS];
+static int num_allocs, num_frees, num_reallocs;
+
+static unsigned int find_ptr(const void *p)
+{
+ unsigned int i;
+
+ for (i = 0; i < MAX_ALLOCATIONS; i++)
+ if (allocations[i] == p)
+ break;
+ return i;
+}
+
+static unsigned int allocations_used(void)
+{
+ unsigned int i, ret = 0;