Huh? We do keep test temp datadirs etc in case of failure. Just not on success.
Our definition of failure there sucks a bit though. We keep the datadirs if any test fails in a script. If the script its self crashes we still blow away the datadirs which is kind of counterintuitive.
I'd like to change the __DIE__ sig handler to only delete on clean script exit code, tap reporting success, and if some env bar like PG_TESTS_NOCLEAN is undefined. The later could also be used in pg_regress etc.