tests: Remove unused cleanup() mechanism from tests

The cleanup() function is defined as a weak symbol in testutils.c, and
called from the various helpers which exit a test.  The idea is that
each test can override it to perform test specific cleanup.  However,
nothing actually uses it.  Furthermore the use of ((weak)) means we can't
run the tests on Windows / mingw.  Just remove it for now.

Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2026-05-26 20:47:02 +10:00
parent 8f48565e5c
commit 84d13508d5
2 changed files with 0 additions and 14 deletions

View file

@ -25,9 +25,6 @@ void test_init(int argc, char *argv[]);
#define streq(s1, s2) (strcmp((s1),(s2)) == 0)
/* Each test case must define this function */
void cleanup(void);
#define verbose_printf(...) \
if (verbose_test) { \
printf(__VA_ARGS__); \
@ -39,21 +36,18 @@ void cleanup(void);
#define PASS() \
do { \
cleanup(); \
printf("PASS\n"); \
exit(RC_PASS); \
} while (0)
#define PASS_INCONCLUSIVE() \
do { \
cleanup(); \
printf("PASS (inconclusive)\n"); \
exit(RC_PASS); \
} while (0)
#define IRRELEVANT() \
do { \
cleanup(); \
printf("PASS (irrelevant)\n"); \
exit(RC_PASS); \
} while (0)
@ -61,21 +55,18 @@ void cleanup(void);
/* Look out, gcc extension below... */
#define FAIL(fmt, ...) \
do { \
cleanup(); \
printf("FAIL\t" fmt "\n", ##__VA_ARGS__); \
exit(RC_FAIL); \
} while (0)
#define CONFIG(fmt, ...) \
do { \
cleanup(); \
printf("Bad configuration: " fmt "\n", ##__VA_ARGS__); \
exit(RC_CONFIG); \
} while (0)
#define TEST_BUG(fmt, ...) \
do { \
cleanup(); \
printf("BUG in testsuite: " fmt "\n", ##__VA_ARGS__); \
exit(RC_BUG); \
} while (0)

View file

@ -42,13 +42,8 @@ static inline void VALGRIND_MAKE_MEM_DEFINED(void *p, size_t len)
int verbose_test = 1;
char *test_name;
void __attribute__((weak)) cleanup(void)
{
}
static void sigint_handler(int signum, siginfo_t *si, void *uc)
{
cleanup();
fprintf(stderr, "%s: %s (pid=%d)\n", test_name,
strsignal(signum), getpid());
exit(RC_BUG);