On Fri, May 7, 2021 at 1:42 AM Elijah Newren <newren@xxxxxxxxx> wrote: > On Thu, May 6, 2021 at 10:32 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote: > > I may be confused, but I'm not following this reasoning. If you're > > using `-i` to debug a failure within the test, then the > > test_when_finished() cleanup actions won't be triggered anyhow > > (they're suppressed by `-i`), so everything will be left behind as > > desired. > > I didn't know that about --immediate. It's good to know. However, > not all debugging is done with -i; someone can also just run the > testsuite expecting everything to pass, see a failure, and then decide > to go look around (and then maybe re-run with -i if the initial > looking around isn't clear). I do that every once in a while. That's certainly an approach, and it's made easier when each test creates its own repo (as the tests you write typically do). In general. though, the majority of Git test scripts run all their tests in a single repo (per test script), with the result that state from a failed test is very frequently clobbered by subsequent tests, which is why --immediate is so useful (it stops the script as soon as one test fails, so the test state is preserved as well as it can be). Due to the "clobbering" problem, I don't think I've ever tried debugging a failed test without using --immediate. > > The problem with not placing this under control of > > test_when_finished() is that, if something in the test proper does > > break, after the "test failed" message, you'll get the undesirable > > alpine-linux-musl behavior you explained in your earlier email where > > test_done() bombs out. > > Unless I'm misunderstanding the test_done() code (I'm looking at > test-lib.sh, lines 1149-1183), test_done() only bombs out when it > tries to "rm -rf $TRASH_DIRECTORY", and it only runs that command if > there are 0 test failures (see test-lib.sh, lines 1149-1183). So, if > something in the test proper does break, that by itself will prevent > test_done() from bombing out. I see what you're saying. Okay.