From 745fbefcf46ab8ed3d2a2ac649e489e8536628d2 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 2 Jul 2003 11:46:19 +0000 Subject: [PATCH] Add --preserve option to test system. [SVN r18915] --- test/BoostBuild.py | 16 ++++++++++++++-- test/test_system.html | 18 ++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/test/BoostBuild.py b/test/BoostBuild.py index 8d069b170..2fbdada1c 100644 --- a/test/BoostBuild.py +++ b/test/BoostBuild.py @@ -219,9 +219,10 @@ class Tester(TestCmd.TestCmd): def dump_stdio(self): print "STDOUT ============" - print self.stdout() + print self.stdout() print "STDERR ============" print self.stderr() + print "END ===============" # # FIXME: Large portion copied from TestSCons.py, should be moved? @@ -309,7 +310,18 @@ class Tester(TestCmd.TestCmd): if condition and dump_stdio: self.dump_stdio() - + + if '--preserve' in sys.argv: + print + print "*** Copying the state of working dir into 'failed_test' ***" + print + path = os.path.join(self.original_workdir, "failed_test") + if os.path.isdir(path): + shutil.rmtree(path, ignore_errors=0) + elif os.path.exists(path): + raise "The path " + path + " already exists and is not directory"; + shutil.copytree(self.workdir, path) + TestCmd.TestCmd.fail_test(self, condition, *args) # A number of methods below check expectations with actual difference diff --git a/test/test_system.html b/test/test_system.html index d06e030af..5ed4cf87e 100644 --- a/test/test_system.html +++ b/test/test_system.html @@ -4,12 +4,13 @@ + "HTML Tidy for Linux/x86 (vers 1st April 2002), see www.w3.org"> A testing system for Boost.Build - + @@ -276,13 +277,10 @@ t.cleanup() pass_test and fail_test are used to explicitly give the test outcome.

-

Typically, after test termination, the working directory is erased. If - is possible to prevent it by setting environmental variables - PRESERVE, PRESERVE_PASS and PRESERVE_FAIL. - Non-zero value of the first makes the working directory preserved in all - cases, while the other variables apply only to specific outcomes. When a - directory is preserved, its name will be printed to the standard - output.

+

Typically, after test termination, the working directory is erased. To + debug a failed test, you should add "--preserve" option when invoking + test. On failure, the working directory will be copied to "failed_test" + directory in the current dir.

Reference documentation