Author: zturner Date: Thu Jan 14 13:14:02 2016 New Revision: 257788 URL: http://llvm.org/viewvc/llvm-project?rev=257788&view=rev Log: Resubmit the fixes for TestProcessLaunch.py.
I was calling the base class tearDown() function the wrong way which for some reason is ok on Python 3 but not on Python 2. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py?rev=257788&r1=257787&r2=257788&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py Thu Jan 14 13:14:02 2016 @@ -4,12 +4,15 @@ 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__) @@ -17,9 +20,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): @@ -180,8 +185,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 +195,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.eStateExited, PROCESS_EXITED) + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) - out = process.GetSTDOUT(len(evil_var)) - self.assertIsNotNone(out, "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('"') - 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') + self.assertEqual(value, evil_var) + process.Continue() + self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED) + pass Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp?rev=257788&r1=257787&r2=257788&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp Thu Jan 14 13:14:02 2016 @@ -5,7 +5,6 @@ int main (int argc, char **argv) { char *evil = getenv("EVIL"); - puts(evil); - return 0; + return 0; // Set breakpoint here. } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits