From 4f29a32da825e5f50d30297fd02171af7944b637 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 5 Nov 2020 15:52:54 +0100 Subject: [PATCH] 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. --- tests/umockdev-test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/umockdev-test.py b/tests/umockdev-test.py index 1b556e1..dc75995 100755 --- a/tests/umockdev-test.py +++ b/tests/umockdev-test.py @@ -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)