mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-21 20:11:08 +00:00
If the test case changes desc, it *must* point to an allocated buffer
which the driver will free after printing the result.
This commit is contained in:
parent
79967f2844
commit
eb10ce6d05
2 changed files with 12 additions and 12 deletions
22
t/t_main.c
22
t/t_main.c
|
@ -146,18 +146,18 @@ t_run_test(struct t_test *t, int n)
|
|||
char *desc;
|
||||
int ret;
|
||||
|
||||
desc = t->desc ? t->desc : "no description";
|
||||
desc = t->desc;
|
||||
ret = (*t->func)(&desc, t->arg);
|
||||
if (ret > 0) {
|
||||
printf("ok %d - %s\n", n + 1, desc);
|
||||
return (1);
|
||||
} else if (ret < 0) {
|
||||
printf("ok %d - # skip %s\n", n + 1, desc);
|
||||
return (1);
|
||||
} else {
|
||||
printf("not ok %d - %s\n", n + 1, desc);
|
||||
return (0);
|
||||
}
|
||||
if (ret > 0)
|
||||
printf("ok %d - ", n + 1);
|
||||
else if (ret < 0)
|
||||
printf("ok %d - # skip ", n + 1);
|
||||
else
|
||||
printf("not ok %d - ", n + 1);
|
||||
printf("%s\n", desc ? desc : "no description");
|
||||
if (desc != t->desc)
|
||||
free(desc);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -491,7 +491,7 @@ t_malloc_leaked(char **desc, void *arg CRYB_UNUSED)
|
|||
asprintf(desc, "%lu allocation(s) leaked", nleaked);
|
||||
return (0);
|
||||
} else {
|
||||
*desc = "no memory leaked";
|
||||
asprintf(desc, "%s", "no memory leaked");
|
||||
return (1);
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue