tests: keep their sessions out of ~/.splinter

`make check` created a session for every splinter invocation that did not set
HOME - the A2A and gateway scripts pass --no-config, which does not change the
session directory. The user's ~/.splinter collected hundreds of "hallo",
"fehler" and "auth ohne token" sessions; the last three in /sessions were test
noise that looked like aborted chats.

- SPLINTER_SESSION_DIR overrides the session directory (o->session_dir still
  wins when a caller names one, so test_engine keeps its temp dir).
- make check exports a mktemp session dir and removes it on exit; the scripts
  that inspect $D/home/.splinter point the variable there.
- docs/CONFIG documents the variable.
- the existing test sessions were moved to
  ~/.splinter/test-sessions-2026-11-18 (not deleted) so /sessions shows the
  real conversations again.

make check: all tests passed; ~/.splinter kept 211 sessions before and after.
This commit is contained in:
lotherk committed 2026-11-18 06:48:01 +00:00
1 parent ddf0ec5462
commit 4be6e26f78
10 files changed
+21 -1

No files matched your search

+8
View File
@@ -2521,7 +2521,15 @@ open_session(struct sp_engine *e, const struct sp_engine_opts *o,
static char sessbuf[512], idbuf[64];
const char *dir = o->session_dir;
const char *id = o->session_id;
const char *envdir = getenv("SPLINTER_SESSION_DIR");
/*
* Tests and throwaway runs get their own directory without a config:
* the suite used to create hundreds of "hallo" sessions in the user's
* ~/.splinter because --no-config does not change where sessions go.
*/
if (dir == NULL && envdir != NULL && *envdir != '\0')
dir = envdir;
if (dir == NULL) {
const char *home = getenv("HOME");