diff options
author | Pavel Labath <labath@google.com> | 2018-03-21 15:29:32 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-03-21 15:29:32 +0000 |
commit | 292178e10463ad40c73bd86c6783180ddf351586 (patch) | |
tree | 11335b95d4c7d492d038f4f1ca860a7201ac2220 /lldb/packages/Python/lldbsuite/test/logging/TestLogging.py | |
parent | bab6ce018fde9a0a9d720b5d0660022bf782e526 (diff) | |
download | bcm5719-llvm-292178e10463ad40c73bd86c6783180ddf351586.tar.gz bcm5719-llvm-292178e10463ad40c73bd86c6783180ddf351586.zip |
Last batch of test-tree cleaning changes
- postmortem tests: make sure the core files are created in the build
folder
- TestSourceManager: copy the .c file into the build dir before
modifying it
- TestLogging: create log files in the build folder
After these changes I get a clean test run (on linux) even if I set the
source tree to be read only. It's possible some of the skipped/xfailed
tests are still creating files in the source tree, but at the moment, I
don't have plans to go hunting for those.
llvm-svn: 328106
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/logging/TestLogging.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/logging/TestLogging.py | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py b/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py index e1ce07b992b..cafbe437d84 100644 --- a/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py +++ b/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py @@ -17,15 +17,11 @@ from lldbsuite.test import lldbutil class LogTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - append_log_file = "lldb-commands-log-append.txt" - truncate_log_file = "lldb-commands-log-truncate.txt" NO_DEBUG_INFO_TESTCASE = True - @classmethod - def classCleanup(cls): - """Cleanup the test byproducts.""" - cls.RemoveTempFile(cls.truncate_log_file) - cls.RemoveTempFile(cls.append_log_file) + def setUp(self): + super(LogTestCase, self).setUp() + self.log_file = self.getBuildArtifact("log-file.txt") def test(self): self.build() @@ -65,22 +61,17 @@ class LogTestCase(TestBase): # Check that lldb truncates its log files def test_log_truncate(self): - if (os.path.exists(self.truncate_log_file)): - os.remove(self.truncate_log_file) - # put something in our log file - with open(self.truncate_log_file, "w") as f: + with open(self.log_file, "w") as f: for i in range(1, 1000): f.write("bacon\n") - self.runCmd( - "log enable -t -f '%s' lldb commands" % - (self.truncate_log_file)) + self.runCmd("log enable -t -f '%s' lldb commands" % self.log_file) self.runCmd("help log") self.runCmd("log disable lldb") - self.assertTrue(os.path.isfile(self.truncate_log_file)) - with open(self.truncate_log_file, "r") as f: + self.assertTrue(os.path.isfile(self.log_file)) + with open(self.log_file, "r") as f: contents = f.read() # check that it got removed @@ -88,21 +79,16 @@ class LogTestCase(TestBase): # Check that lldb can append to a log file def test_log_append(self): - if (os.path.exists(self.append_log_file)): - os.remove(self.append_log_file) - # put something in our log file - with open(self.append_log_file, "w") as f: + with open(self.log_file, "w") as f: f.write("bacon\n") - self.runCmd( - "log enable -t -a -f '%s' lldb commands" % - (self.append_log_file)) + self.runCmd( "log enable -t -a -f '%s' lldb commands" % self.log_file) self.runCmd("help log") self.runCmd("log disable lldb") - self.assertTrue(os.path.isfile(self.append_log_file)) - with open(self.append_log_file, "r") as f: + self.assertTrue(os.path.isfile(self.log_file)) + with open(self.log_file, "r") as f: contents = f.read() # check that it is still there |