diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:50:09 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:50:09 +0000 | 
| commit | f3fbd1c0586ff6ec7895991e6c28f61a503c36a8 (patch) | |
| tree | 48d008fd3df8c0e73271a4b18474e0aac6dbfe33 /packages/Python/lldbsuite/test/functionalities/process_launch | |
| parent | 2fc5d2d1dfaf623ce4e24cd8590565902f8c557c (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/process_launch')
| -rw-r--r-- | packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py | 48 | ||||
| -rw-r--r-- | packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp | 3 | 
2 files changed, 29 insertions, 22 deletions
| diff --git a/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py index 3131000be428..5998edb3c7e0 100644 --- a/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py +++ b/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py @@ -4,11 +4,16 @@ Test lldb process launch flags.  from __future__ import print_function +import copy +import os +import time - -import os, time  import lldb +from lldbsuite.test.decorators import *  from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +import six  class ProcessLaunchTestCase(TestBase): @@ -17,9 +22,11 @@ class ProcessLaunchTestCase(TestBase):      def setUp(self):          # Call super's setUp().          TestBase.setUp(self) -        # disable "There is a running process, kill it and restart?" prompt          self.runCmd("settings set auto-confirm true") -        self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm")) + +    def tearDown(self): +        self.runCmd("settings clear auto-confirm") +        TestBase.tearDown(self)      @not_remote_testsuite_ready      def test_io (self): @@ -109,7 +116,7 @@ class ProcessLaunchTestCase(TestBase):      # rdar://problem/9056462      # The process launch flag '-w' for setting the current working directory not working?      @not_remote_testsuite_ready -    @expectedFailureLinux("llvm.org/pr20265") +    @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20265")      def test_set_working_dir (self):          """Test that '-w dir' sets the working dir when running the inferior."""          d = {'CXX_SOURCES' : 'print_cwd.cpp'} @@ -180,8 +187,9 @@ class ProcessLaunchTestCase(TestBase):              self.fail(err_msg)      def test_environment_with_special_char (self): -        """Test that environment variables containing '*' and '}' are communicated correctly to the lldb-server.""" -        d = {'CXX_SOURCES' : 'print_env.cpp'} +        """Test that environment variables containing '*' and '}' are handled correctly by the inferior.""" +        source = 'print_env.cpp' +        d = {'CXX_SOURCES' : source}          self.build(dictionary=d)          self.setTearDownCleanup(d)          exe = os.path.join (os.getcwd(), "a.out") @@ -189,19 +197,19 @@ class ProcessLaunchTestCase(TestBase):          evil_var = 'INIT*MIDDLE}TAIL'          target = self.dbg.CreateTarget(exe) -        process = target.LaunchSimple(None, ['EVIL=' + evil_var], self.get_process_working_directory()) -        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) - -        out = process.GetSTDOUT(len(evil_var)) -        self.assertIsNotNone(out, "Encountered an error reading the process's output") +        main_source_spec = lldb.SBFileSpec(source) +        breakpoint = target.BreakpointCreateBySourceRegex('// Set breakpoint here.', main_source_spec) -        out = out[:len(evil_var)] -        if out != evil_var: -            self.fail('The environment variable was mis-coded: %s\n' % repr(out)) +        process = target.LaunchSimple(None, ['EVIL=' + evil_var], self.get_process_working_directory()) +        self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) -        newline = process.GetSTDOUT(1) -        self.assertIsNotNone(newline, "Encountered an error reading the process's output") +        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('"') -        newline = newline[0] -        if newline != '\r' and newline != '\n': -            self.fail('Garbage at end of environment variable') +        self.assertEqual(value, evil_var) +        process.Continue() +        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) +        pass diff --git a/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp b/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp index cbb9b2175916..8c6df8ea01a4 100644 --- a/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp +++ b/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp @@ -5,7 +5,6 @@  int main (int argc, char **argv)  {    char *evil = getenv("EVIL"); -  puts(evil); -  return 0; +  return 0;  // Set breakpoint here.  } | 
