fix(controller-tests): clean /tmp/xce_* scratch dirs to stop 28G disk fill
Test fixtures create WAL/snapshot scratch dirs via mkdtemp (/tmp/xce_e2e_ckpt_*, /tmp/xce_ucaf61_*, /tmp/xce_ts_*) but their teardown only frees the persist_t — the dir is never removed. persist_init preallocates a 64MB WAL segment per init, so a full controller_unit_test run leaves ~28G in /tmp in under a minute, filling the root filesystem. Remove only xce_* DIRECTORIES at suite start (stale leftovers) and via atexit (this run). Files are untouched: the user's /tmp/xce-mcp binary and the suite's own /tmp/xce_test.log survive the -type d filter.
This commit is contained in:
parent
730a8ebcd4
commit
67f3f6ad80
1 changed files with 21 additions and 0 deletions
|
|
@ -3757,6 +3757,22 @@ static int worker_house_keeping(void* arg)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* bug-XXXX (disk fill): the persist_* / config_repl / HA test fixtures create
|
||||||
|
* their WAL/snapshot scratch dirs via mkdtemp("/tmp/xce_..._XXXXXX") but their
|
||||||
|
* teardown only frees the persist_t — the directory is never removed. A full
|
||||||
|
* controller_unit_test run therefore leaves ~28G behind in /tmp in under a
|
||||||
|
* minute, filling a 62G root filesystem. Remove only xce_* DIRECTORIES (never
|
||||||
|
* files — the user's /tmp/xce-mcp binary and the suite's own /tmp/xce_test.log
|
||||||
|
* must survive). Run at suite start (stale leftovers from prior runs) and on
|
||||||
|
* exit via atexit (this run). */
|
||||||
|
static void clean_test_scratch_dirs(void)
|
||||||
|
{
|
||||||
|
if (system("find /tmp -maxdepth 1 -type d -name 'xce_*' "
|
||||||
|
"-exec rm -rf {} + 2>/dev/null") != 0) {
|
||||||
|
/* non-zero only if find is unavailable; cleanup is best-effort */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
struct arguments arguments;
|
struct arguments arguments;
|
||||||
|
|
@ -3769,6 +3785,11 @@ int main(int argc, char* argv[])
|
||||||
memset(&arguments, 0x0, sizeof(arguments));
|
memset(&arguments, 0x0, sizeof(arguments));
|
||||||
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
||||||
|
|
||||||
|
/* Bug-XXXX: remove stale test scratch dirs from prior runs, then ensure
|
||||||
|
* this run's scratch dirs are cleaned on exit. */
|
||||||
|
clean_test_scratch_dirs();
|
||||||
|
atexit(clean_test_scratch_dirs);
|
||||||
|
|
||||||
if (arguments.verbose != 0) {
|
if (arguments.verbose != 0) {
|
||||||
loglevel = verbose_to_loglevel(arguments.verbose);
|
loglevel = verbose_to_loglevel(arguments.verbose);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue