Skip memory leak checks if coverage analysis is enabled.

This commit is contained in:
Dag-Erling Smørgrav 2014-12-20 01:30:01 +00:00 committed by des
parent 75daba7501
commit eadeeb486c
2 changed files with 10 additions and 1 deletions

View file

@ -144,11 +144,16 @@ static int
t_run_test(struct t_test *t, int n) t_run_test(struct t_test *t, int n)
{ {
char *desc; char *desc;
int ret;
desc = t->desc ? t->desc : "no description"; desc = t->desc ? t->desc : "no description";
if ((*t->func)(&desc, t->arg)) { ret = (*t->func)(&desc, t->arg);
if (ret > 0) {
printf("ok %d - %s\n", n + 1, desc); printf("ok %d - %s\n", n + 1, desc);
return (1); return (1);
} else if (ret < 0) {
printf("ok %d - # skip %s\n", n + 1, desc);
return (1);
} else { } else {
printf("not ok %d - %s\n", n + 1, desc); printf("not ok %d - %s\n", n + 1, desc);
return (0); return (0);

View file

@ -478,6 +478,7 @@ t_malloc_printstats(FILE *f)
static int static int
t_malloc_leaked(char **desc, void *arg CRYB_UNUSED) t_malloc_leaked(char **desc, void *arg CRYB_UNUSED)
{ {
#if !CRYB_COVERAGE
struct bucket *b; struct bucket *b;
unsigned int shift; unsigned int shift;
unsigned long nleaked; unsigned long nleaked;
@ -493,6 +494,9 @@ t_malloc_leaked(char **desc, void *arg CRYB_UNUSED)
*desc = "no memory leaked"; *desc = "no memory leaked";
return (1); return (1);
} }
#else
return (-1);
#endif
} }
struct t_test t_memory_leak = { struct t_test t_memory_leak = {