PerlAlien/Alien-Build

RFE: Test::Alien: Allow retention of build directory upon failure

djerius opened this issue · 2 comments

Test::Alien helpfully cleans up after itself, even in the case of failure.

However, if there's a compile or link failure, debugging requires one to have access to the temp build directory.

One approach to this is taken by Test::TempDir::Tiny, which retains the temporary directories if a test fails. Given an appropriate environment variable it will always retain directories, regardless of test success.

An alternative is to always clean, but provide an environment variable which will retain the build directory on failure (or always, as in the case of Test::TempDir::Tiny). Both options would be useful; it's sometimes easier to prototype in build directories rather than in the source as it avoids running the whole build machinery.

One issue with retaining build directories is finding them. It would be useful if Test::Alien outputs message with the name of the directory that is retained.

My thinking on this has evolved, I think I said on IRC that I didn't want to keep the temp files around unless asked for (even if failed). This is still my personal preference, but I think more useful for other developers to keep the files on failure by default. So, in #326 I've made this the default behavior and added an environment variable that will override the keep regardless of success or failure. I've also added a diagnostic to indicate the directory location if it is kept under either mode.

Thanks!