summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/logging/TestLogging.py
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
commitf73363f1dd94996356cefbf24388f561891acf0b (patch)
treee3c31248bdb36eaec5fd833490d4278162dba2a0 /packages/Python/lldbsuite/test/logging/TestLogging.py
parent160ee69dd7ae18978f4068116777639ea98dc951 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/logging/TestLogging.py')
-rw-r--r--packages/Python/lldbsuite/test/logging/TestLogging.py55
1 files changed, 14 insertions, 41 deletions
diff --git a/packages/Python/lldbsuite/test/logging/TestLogging.py b/packages/Python/lldbsuite/test/logging/TestLogging.py
index 690c4f6ea69e6..cafbe437d84d1 100644
--- a/packages/Python/lldbsuite/test/logging/TestLogging.py
+++ b/packages/Python/lldbsuite/test/logging/TestLogging.py
@@ -17,34 +17,19 @@ 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()
- if self.debug_info == "dsym":
- self.command_log_tests("dsym")
- else:
- self.command_log_tests("dwarf")
-
- def command_log_tests(self, type):
- exe = os.path.join(os.getcwd(), "a.out")
+ exe = self.getBuildArtifact("a.out")
self.expect("file " + exe,
patterns=["Current executable set to .*a.out"])
- log_file = os.path.join(
- os.getcwd(),
- "lldb-commands-log-%s-%s-%s.txt" %
- (type,
- os.path.basename(
- self.getCompiler()),
- self.getArchitecture()))
+ log_file = os.path.join(self.getBuildDir(), "lldb-commands-log.txt")
if (os.path.exists(log_file)):
os.remove(log_file)
@@ -75,47 +60,35 @@ class LogTestCase(TestBase):
"Something was written to the log file.")
# Check that lldb truncates its log files
- @no_debug_info_test
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
self.assertEquals(contents.find("bacon"), -1)
# Check that lldb can append to a log file
- @no_debug_info_test
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