summaryrefslogtreecommitdiff
path: root/auto_tests/resource_leak_test.c
diff options
context:
space:
mode:
authorRobin Lindén <dev@robinlinden.eu>2018-02-18 23:10:59 +0100
committeriphydf <iphydf@users.noreply.github.com>2018-02-18 23:59:22 +0000
commitec8b911d7cc8b089a9a7b462748d752a2243cc35 (patch)
tree6d2a93823bf70393d9f709fa86fa20f15b306594 /auto_tests/resource_leak_test.c
parent9d58e0aa0a846328acadfe4b5f3802a4746a4967 (diff)
Increase range of ports available to Toxes during tests
Diffstat (limited to 'auto_tests/resource_leak_test.c')
-rw-r--r--auto_tests/resource_leak_test.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/auto_tests/resource_leak_test.c b/auto_tests/resource_leak_test.c
index 1bb70d9a..cf451ebd 100644
--- a/auto_tests/resource_leak_test.c
+++ b/auto_tests/resource_leak_test.c
@@ -38,17 +38,26 @@ int main(void)
38#endif 38#endif
39 printf("Creating/deleting %d tox instances\n", ITERATIONS); 39 printf("Creating/deleting %d tox instances\n", ITERATIONS);
40 40
41 int allocated = 0;
42
41 for (int i = 0; i < ITERATIONS; i++) { 43 for (int i = 0; i < ITERATIONS; i++) {
42 Tox *tox = tox_new(nullptr, nullptr); 44 Tox *tox = tox_new(nullptr, nullptr);
43 tox_iterate(tox, nullptr); 45
44 tox_kill(tox); 46 if (tox != nullptr) {
47 tox_iterate(tox, nullptr);
48 tox_kill(tox);
49 allocated++;
50 }
51
45#if HAVE_SBRK 52#if HAVE_SBRK
46 char *next_hwm = (char *)sbrk(0); 53 char *next_hwm = (char *)sbrk(0);
47 assert(hwm == next_hwm); 54 assert(hwm == next_hwm);
48#endif 55#endif
49 } 56 }
50 57
51 puts("Success: no resource leaks detected"); 58 assert(allocated >= ITERATIONS / 2);
59 printf("Success: no resource leaks detected in %d tox_new calls (tried %d)\n",
60 allocated, ITERATIONS);
52 61
53 return 0; 62 return 0;
54} 63}