summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-01-13 22:32:31 +0000
committerZachary Turner <zturner@google.com>2016-01-13 22:32:31 +0000
commit400767af54d50fbf3c287cbfe78e58daec335d2f (patch)
tree102925da4ec2e18ab7aa6e45b02a0e77d05defe6 /lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
parent00ebfd4b43cb3e7fc81ef463c83f448b206c1a1e (diff)
downloadbcm5719-llvm-400767af54d50fbf3c287cbfe78e58daec335d2f.tar.gz
bcm5719-llvm-400767af54d50fbf3c287cbfe78e58daec335d2f.zip
Revert changes to TestProcessLaunch.py as they are breaking a build.
llvm-svn: 257690
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py49
1 files changed, 18 insertions, 31 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
index 0eeb6ff9379..3131000be42 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
@@ -4,15 +4,12 @@ Test lldb process launch flags.
from __future__ import print_function
-import copy
-import os
-import time
+
+import os, time
import lldb
from lldbsuite.test.lldbtest import *
-import six
-
class ProcessLaunchTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,18 +17,9 @@ class ProcessLaunchTestCase(TestBase):
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- self.stdout_redirect_file = 'lldb-stdout-redirect.txt'
# disable "There is a running process, kill it and restart?" prompt
self.runCmd("settings set auto-confirm true")
- def tearDown(self):
- self.runCmd("settings clear auto-confirm")
-
- try:
- os.unlink(self.stdout_redirect_file)
- except:
- pass
-
- super().tearDown()
+ self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
@not_remote_testsuite_ready
def test_io (self):
@@ -192,9 +180,8 @@ class ProcessLaunchTestCase(TestBase):
self.fail(err_msg)
def test_environment_with_special_char (self):
- """Test that environment variables containing '*' and '}' are handled correctly by the inferior."""
- source = 'print_env.cpp'
- d = {'CXX_SOURCES' : source}
+ """Test that environment variables containing '*' and '}' are communicated correctly to the lldb-server."""
+ d = {'CXX_SOURCES' : 'print_env.cpp'}
self.build(dictionary=d)
self.setTearDownCleanup(d)
exe = os.path.join (os.getcwd(), "a.out")
@@ -202,19 +189,19 @@ class ProcessLaunchTestCase(TestBase):
evil_var = 'INIT*MIDDLE}TAIL'
target = self.dbg.CreateTarget(exe)
- main_source_spec = lldb.SBFileSpec(source)
- breakpoint = target.BreakpointCreateBySourceRegex('// Set breakpoint here.', main_source_spec)
-
process = target.LaunchSimple(None, ['EVIL=' + evil_var], self.get_process_working_directory())
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint)
- self.assertEqual(len(threads), 1)
- frame = threads[0].GetFrameAtIndex(0)
- sbvalue = frame.EvaluateExpression("evil")
- value = sbvalue.GetSummary().strip('"')
+ out = process.GetSTDOUT(len(evil_var))
+ self.assertIsNotNone(out, "Encountered an error reading the process's output")
- self.assertEqual(value, evil_var)
- process.Continue()
- self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
- pass \ No newline at end of file
+ out = out[:len(evil_var)]
+ if out != evil_var:
+ self.fail('The environment variable was mis-coded: %s\n' % repr(out))
+
+ newline = process.GetSTDOUT(1)
+ self.assertIsNotNone(newline, "Encountered an error reading the process's output")
+
+ newline = newline[0]
+ if newline != '\r' and newline != '\n':
+ self.fail('Garbage at end of environment variable')
OpenPOWER on IntegriCloud