tests: Store temporary directory on failure

It is not very useful to just delete the data again after a failure, as
it might be useful for debugging. Just store it into an "errors"
subdirectory of the PWD in the hope that this is a sane location.

Note that it'll error out if the directory already exists, but that
should be acceptable in all cases. i.e. it won't exist in the CI and
developers can just wipe the directory.
This commit is contained in:
Benjamin Berg 2020-11-05 15:52:54 +01:00
parent e5fa54e8e7
commit 4f29a32da8

View file

@ -87,6 +87,11 @@ try:
if os.path.exists(os.path.join(ddir, "custom.ioctl")):
custom()
except:
# Store created output files for inspection (in the build directory)
outdir = os.path.join('errors', os.path.basename(ddir))
shutil.copytree(tmpdir, outdir)
finally:
shutil.rmtree(tmpdir)