<div dir="ltr">Yea, this is strange. The bot does not even appear to be red. It's just yellow.<div><br></div><div>Anyway, r<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">327633 ought to fix the breakage. As I said in the commit message, the cause is different treatment of relative paths to "process launch --stdin". Do you guys have any opinion on which behavior makes more sense?</span></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 15 Mar 2018 at 15:21, Davide Italiano <<a href="mailto:dccitaliano@gmail.com">dccitaliano@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don't seem to receive mails either (although I should).<br>
Vedant is babysitting the bots this week. Vedant, are you receiving<br>
blame mails or the mail notification is disabled altogether?<br>
<br>
On Thu, Mar 15, 2018 at 8:06 AM, Pavel Labath <<a href="mailto:labath@google.com" target="_blank">labath@google.com</a>> wrote:<br>
> Yes, it certainly looks that way. Taking a look now.<br>
><br>
> PS: I didn't get any email about this.<br>
><br>
> On Thu, 15 Mar 2018 at 15:04, Davide Italiano <<a href="mailto:dccitaliano@gmail.com" target="_blank">dccitaliano@gmail.com</a>> wrote:<br>
>><br>
>> This is the most likely cause for the failures we're starting to see<br>
>> on both our bots on greendragon.<br>
>> Can you please take a look?<br>
>><br>
>> <a href="http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/5791/" rel="noreferrer" target="_blank">http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/5791/</a><br>
>><br>
>><br>
>> Thanks!<br>
>><br>
>> --<br>
>> Davide<br>
>><br>
>> On Thu, Mar 15, 2018 at 6:47 AM, Pavel Labath via lldb-commits<br>
>> <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
>> > Author: labath<br>
>> > Date: Thu Mar 15 06:47:09 2018<br>
>> > New Revision: 327625<br>
>> ><br>
>> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=327625&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=327625&view=rev</a><br>
>> > Log:<br>
>> > Next batch of test-tree-cleaning changes<br>
>> ><br>
>> > Summary:<br>
>> > The changes here fall into several categories.<br>
>> ><br>
>> > - some tests were redirecting inferior stdout/err to a file. For these I<br>
>> > make sure we use an absolute path for the file. I also create a<br>
>> > lldbutil.read_file_on_target helper function to encapsulate the<br>
>> > differences between reading a file locally and remotely.<br>
>> > - some tests were redirecting the pexpect I/O into a file. For these I<br>
>> > use a python StringIO object to avoid creating a file altogether.<br>
>> > - the TestSettings inferior was creating a file. Here, I make sure the<br>
>> > inferior is launched with pwd=build-dir so that the files end up<br>
>> > created there.<br>
>> > - lldb-mi --log (used by some tests) creates a log file in PWD without<br>
>> > the ability say differently. To make this work I make sure to run<br>
>> > lldb-mi with PWD=build_dir. This in turn necessitated a couple of<br>
>> > changes in other lldb-mi tests, which were using relative paths to<br>
>> > access the source tree.<br>
>> ><br>
>> > Reviewers: aprantl<br>
>> ><br>
>> > Subscribers: ki.stfu, mehdi_amini, lldb-commits<br>
>> ><br>
>> > Differential Revision: <a href="https://reviews.llvm.org/D44159" rel="noreferrer" target="_blank">https://reviews.llvm.org/D44159</a><br>
>> ><br>
>> > Modified:<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py<br>
>> ><br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -19,6 +19,7 @@ import six<br>
>> > class ProcessLaunchTestCase(TestBase):<br>
>> ><br>
>> > mydir = TestBase.compute_mydir(__file__)<br>
>> > + NO_DEBUG_INFO_TESTCASE = True<br>
>> ><br>
>> > def setUp(self):<br>
>> > # Call super's setUp().<br>
>> > @@ -38,8 +39,8 @@ class ProcessLaunchTestCase(TestBase):<br>
>> > patterns=["Current executable set to .*a.out"])<br>
>> ><br>
>> > in_file = "input-file.txt"<br>
>> > - out_file = "output-test.out"<br>
>> > - err_file = "output-test.err"<br>
>> > + out_file = lldbutil.append_to_process_working_directory(self,<br>
>> > "output-test.out")<br>
>> > + err_file = lldbutil.append_to_process_working_directory(self,<br>
>> > "output-test.err")<br>
>> ><br>
>> > # Make sure the output files do not exist before launching the<br>
>> > process<br>
>> > try:<br>
>> > @@ -52,8 +53,8 @@ class ProcessLaunchTestCase(TestBase):<br>
>> > except OSError:<br>
>> > pass<br>
>> ><br>
>> > - launch_command = "process launch -i " + \<br>
>> > - in_file + " -o " + out_file + " -e " + err_file<br>
>> > + launch_command = "process launch -i '{0}' -o '{1}' -e '{2}' -w<br>
>> > '{3}'".format(<br>
>> > + in_file, out_file, err_file,<br>
>> > self.get_process_working_directory())<br>
>> ><br>
>> > if lldb.remote_platform:<br>
>> > self.runCmd('platform put-file "{local}"<br>
>> > "{remote}"'.format(<br>
>> > @@ -62,55 +63,19 @@ class ProcessLaunchTestCase(TestBase):<br>
>> > self.expect(launch_command,<br>
>> > patterns=["Process .* launched: .*a.out"])<br>
>> ><br>
>> > - if lldb.remote_platform:<br>
>> > - self.runCmd('platform get-file "{remote}"<br>
>> > "{local}"'.format(<br>
>> > - remote=out_file, local=out_file))<br>
>> > - self.runCmd('platform get-file "{remote}"<br>
>> > "{local}"'.format(<br>
>> > - remote=err_file, local=err_file))<br>
>> > -<br>
>> > success = True<br>
>> > err_msg = ""<br>
>> ><br>
>> > - # Check to see if the 'stdout' file was created<br>
>> > - try:<br>
>> > - out_f = open(out_file)<br>
>> > - except IOError:<br>
>> > + out = lldbutil.read_file_on_target(self, out_file)<br>
>> > + if out != "This should go to stdout.\n":<br>
>> > success = False<br>
>> > - err_msg = err_msg + " ERROR: stdout file was not<br>
>> > created.\n"<br>
>> > - else:<br>
>> > - # Check to see if the 'stdout' file contains the right<br>
>> > output<br>
>> > - line = out_f.readline()<br>
>> > - if line != "This should go to stdout.\n":<br>
>> > - success = False<br>
>> > - err_msg = err_msg + " ERROR: stdout file does not<br>
>> > contain correct output.\n"<br>
>> > - out_f.close()<br>
>> > + err_msg = err_msg + " ERROR: stdout file does not<br>
>> > contain correct output.\n"<br>
>> ><br>
>> > - # Try to delete the 'stdout' file<br>
>> > - try:<br>
>> > - os.remove(out_file)<br>
>> > - except OSError:<br>
>> > - pass<br>
>> ><br>
>> > - # Check to see if the 'stderr' file was created<br>
>> > - try:<br>
>> > - err_f = open(err_file)<br>
>> > - except IOError:<br>
>> > + err = lldbutil.read_file_on_target(self, err_file)<br>
>> > + if err != "This should go to stderr.\n":<br>
>> > success = False<br>
>> > - err_msg = err_msg + " ERROR: stderr file was not<br>
>> > created.\n"<br>
>> > - else:<br>
>> > - # Check to see if the 'stderr' file contains the right<br>
>> > output<br>
>> > - line = err_f.readline()<br>
>> > - if line != "This should go to stderr.\n":<br>
>> > - success = False<br>
>> > - err_msg = err_msg + " ERROR: stderr file does not<br>
>> > contain correct output.\n\<br>
>> > -"<br>
>> > - err_f.close()<br>
>> > -<br>
>> > - # Try to delete the 'stderr' file<br>
>> > - try:<br>
>> > - os.remove(err_file)<br>
>> > - except OSError:<br>
>> > - pass<br>
>> > + err_msg = err_msg + " ERROR: stderr file does not<br>
>> > contain correct output.\n"<br>
>> ><br>
>> > if not success:<br>
>> > self.fail(err_msg)<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -10,7 +10,7 @@ import lldb<br>
>> > from lldbsuite.test.decorators import *<br>
>> > from lldbsuite.test.lldbtest import *<br>
>> > from lldbsuite.test import lldbutil<br>
>> > -<br>
>> > +import six<br>
>> ><br>
>> > class SingleQuoteInCommandLineTestCase(TestBase):<br>
>> ><br>
>> > @@ -50,32 +50,24 @@ class SingleQuoteInCommandLineTestCase(T<br>
>> > self.getBuildArtifact(self.myexe)))<br>
>> > child = self.child<br>
>> > child.setecho(True)<br>
>> > - # Turn on logging for input/output to/from the child.<br>
>> > - with open('child_send.txt', 'w') as f_send:<br>
>> > - with open('child_read.txt', 'w') as f_read:<br>
>> > - child.logfile_send = f_send<br>
>> > - child.logfile_read = f_read<br>
>> > -<br>
>> > - child.expect_exact(prompt)<br>
>> > -<br>
>> > - child.send("help watchpoint")<br>
>> > - child.sendline('')<br>
>> > - child.expect_exact(prompt)<br>
>> > + child.logfile_send = send = six.StringIO()<br>
>> > + child.logfile_read = read = six.StringIO()<br>
>> > + child.expect_exact(prompt)<br>
>> > +<br>
>> > + child.send("help watchpoint")<br>
>> > + child.sendline('')<br>
>> > + child.expect_exact(prompt)<br>
>> ><br>
>> > # Now that the necessary logging is done, restore logfile to<br>
>> > None to<br>
>> > # stop further logging.<br>
>> > child.logfile_send = None<br>
>> > child.logfile_read = None<br>
>> ><br>
>> > - with open('child_send.txt', 'r') as fs:<br>
>> > - if self.TraceOn():<br>
>> > - print("\n\nContents of child_send.txt:")<br>
>> > - print(fs.read())<br>
>> > - with open('child_read.txt', 'r') as fr:<br>
>> > - from_child = fr.read()<br>
>> > - if self.TraceOn():<br>
>> > - print("\n\nContents of child_read.txt:")<br>
>> > - print(from_child)<br>
>> > + if self.TraceOn():<br>
>> > + print("\n\nContents of send")<br>
>> > + print(send.getvalue())<br>
>> > + print("\n\nContents of read")<br>
>> > + print(read.getvalue())<br>
>> ><br>
>> > - self.expect(from_child, exe=False,<br>
>> > - substrs=["Current executable set to"])<br>
>> > + self.expect(read.getvalue(), exe=False,<br>
>> > + substrs=["Current executable set to"])<br>
>> ><br>
>> > Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > --- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)<br>
>> > +++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Thu Mar 15<br>
>> > 06:47:09 2018<br>
>> > @@ -1321,6 +1321,21 @@ def skip_if_library_missing(test, target<br>
>> > target))<br>
>> ><br>
>> ><br>
>> > +def read_file_on_target(test, remote):<br>
>> > + if lldb.remote_platform:<br>
>> > + local = test.getBuildArtifact("file_from_target")<br>
>> > + error = lldb.remote_platform.Get(lldb.SBFileSpec(remote,<br>
>> > False),<br>
>> > + lldb.SBFileSpec(local, True))<br>
>> > + test.assertTrue(error.Success(), "Reading file {0} failed:<br>
>> > {1}".format(remote, error))<br>
>> > + else:<br>
>> > + local = remote<br>
>> > + with open(local, 'r') as f:<br>
>> > + return f.read()<br>
>> > +<br>
>> > +def read_file_from_process_wd(test, name):<br>
>> > + path = append_to_process_working_directory(test, name)<br>
>> > + return read_file_on_target(test, path)<br>
>> > +<br>
>> > def wait_for_file_on_target(testcase, file_path, max_attempts=6):<br>
>> > for i in range(max_attempts):<br>
>> > err, retcode, msg = testcase.run_platform_command("ls %s" %<br>
>> > file_path)<br>
>> > @@ -1335,9 +1350,4 @@ def wait_for_file_on_target(testcase, fi<br>
>> > "File %s not found even after %d attempts." %<br>
>> > (file_path, max_attempts))<br>
>> ><br>
>> > - err, retcode, data = testcase.run_platform_command("cat %s" %<br>
>> > (file_path))<br>
>> > -<br>
>> > - testcase.assertTrue(<br>
>> > - err.Success() and retcode == 0, "Failed to read file %s: %s,<br>
>> > retcode: %d" %<br>
>> > - (file_path, err.GetCString(), retcode))<br>
>> > - return data<br>
>> > + return read_file_on_target(testcase, file_path)<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > --- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py<br>
>> > (original)<br>
>> > +++ lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -17,16 +17,8 @@ from lldbsuite.test import lldbutil<br>
>> > class SettingsCommandTestCase(TestBase):<br>
>> ><br>
>> > mydir = TestBase.compute_mydir(__file__)<br>
>> > + NO_DEBUG_INFO_TESTCASE = True<br>
>> ><br>
>> > - @classmethod<br>
>> > - def classCleanup(cls):<br>
>> > - """Cleanup the test byproducts."""<br>
>> > - cls.RemoveTempFile("output1.txt")<br>
>> > - cls.RemoveTempFile("output2.txt")<br>
>> > - cls.RemoveTempFile("stderr.txt")<br>
>> > - cls.RemoveTempFile("stdout.txt")<br>
>> > -<br>
>> > - @no_debug_info_test<br>
>> > def test_apropos_should_also_search_settings_description(self):<br>
>> > """Test that 'apropos' command should also search descriptions<br>
>> > for the settings variables."""<br>
>> ><br>
>> > @@ -35,7 +27,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > "environment variables",<br>
>> > "executable's environment"])<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_append_target_env_vars(self):<br>
>> > """Test that 'append target.run-args' works."""<br>
>> > # Append the env-vars.<br>
>> > @@ -48,7 +39,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > self.expect('settings show target.env-vars',<br>
>> > substrs=['MY_ENV_VAR=YES'])<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_insert_before_and_after_target_run_args(self):<br>
>> > """Test that 'insert-before/after target.run-args' works."""<br>
>> > # Set the run-args first.<br>
>> > @@ -70,7 +60,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > '[3]: "b"',<br>
>> > '[4]: "c"'])<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_replace_target_run_args(self):<br>
>> > """Test that 'replace target.run-args' works."""<br>
>> > # Set the run-args and then replace the index-0 element.<br>
>> > @@ -88,7 +77,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > '[1]: "b"',<br>
>> > '[2]: "c"'])<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_set_prompt(self):<br>
>> > """Test that 'set prompt' actually changes the prompt."""<br>
>> ><br>
>> > @@ -106,7 +94,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > # Use '-r' option to reset to the original default prompt.<br>
>> > self.runCmd("settings clear prompt")<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_set_term_width(self):<br>
>> > """Test that 'set term-width' actually changes the<br>
>> > term-width."""<br>
>> ><br>
>> > @@ -153,7 +140,8 @@ class SettingsCommandTestCase(TestBase):<br>
>> > substrs=[format_string])<br>
>> ><br>
>> > self.runCmd("breakpoint set -n main")<br>
>> > - self.runCmd("run")<br>
>> > + self.runCmd("process launch --working-dir<br>
>> > '{0}'".format(self.get_process_working_directory()),<br>
>> > + RUN_SUCCEEDED)<br>
>> > self.expect("thread backtrace",<br>
>> > substrs=["`main", self.getSourceDir()])<br>
>> ><br>
>> > @@ -231,13 +219,11 @@ class SettingsCommandTestCase(TestBase):<br>
>> > self.addTearDownHook(<br>
>> > lambda: self.runCmd("settings clear target.env-vars"))<br>
>> ><br>
>> > - self.runCmd("run", RUN_SUCCEEDED)<br>
>> > + self.runCmd("process launch --working-dir<br>
>> > '{0}'".format(self.get_process_working_directory()),<br>
>> > + RUN_SUCCEEDED)<br>
>> ><br>
>> > # Read the output file produced by running the program.<br>
>> > - if lldb.remote_platform:<br>
>> > - self.runCmd('platform get-file "output2.txt"<br>
>> > "output2.txt"')<br>
>> > - with open('output2.txt', 'r') as f:<br>
>> > - output = f.read()<br>
>> > + output = lldbutil.read_file_from_process_wd(self,<br>
>> > "output2.txt")<br>
>> ><br>
>> > self.expect(<br>
>> > output,<br>
>> > @@ -272,13 +258,11 @@ class SettingsCommandTestCase(TestBase):<br>
>> > os.environ.pop("MY_HOST_ENV_VAR2")<br>
>> ><br>
>> > self.addTearDownHook(unset_env_variables)<br>
>> > - self.runCmd("run", RUN_SUCCEEDED)<br>
>> > + self.runCmd("process launch --working-dir<br>
>> > '{0}'".format(self.get_process_working_directory()),<br>
>> > + RUN_SUCCEEDED)<br>
>> ><br>
>> > # Read the output file produced by running the program.<br>
>> > - if lldb.remote_platform:<br>
>> > - self.runCmd('platform get-file "output1.txt"<br>
>> > "output1.txt"')<br>
>> > - with open('output1.txt', 'r') as f:<br>
>> > - output = f.read()<br>
>> > + output = lldbutil.read_file_from_process_wd(self,<br>
>> > "output1.txt")<br>
>> ><br>
>> > self.expect(<br>
>> > output,<br>
>> > @@ -296,8 +280,10 @@ class SettingsCommandTestCase(TestBase):<br>
>> > self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)<br>
>> ><br>
>> > # Set the error-path and output-path and verify both are set.<br>
>> > - self.runCmd("settings set target.error-path stderr.txt")<br>
>> > - self.runCmd("settings set target.output-path stdout.txt")<br>
>> > + self.runCmd("settings set target.error-path '{0}'".format(<br>
>> > + lldbutil.append_to_process_working_directory(self,<br>
>> > "stderr.txt")))<br>
>> > + self.runCmd("settings set target.output-path '{0}".format(<br>
>> > + lldbutil.append_to_process_working_directory(self,<br>
>> > "stdout.txt")))<br>
>> > # And add hooks to restore the original settings during<br>
>> > tearDown().<br>
>> > self.addTearDownHook(<br>
>> > lambda: self.runCmd("settings clear target.output-path"))<br>
>> > @@ -306,44 +292,26 @@ class SettingsCommandTestCase(TestBase):<br>
>> ><br>
>> > self.expect("settings show target.error-path",<br>
>> > SETTING_MSG("target.error-path"),<br>
>> > - substrs=['target.error-path (file) =<br>
>> > "stderr.txt"'])<br>
>> > + substrs=['target.error-path (file)',<br>
>> > 'stderr.txt"'])<br>
>> ><br>
>> > self.expect("settings show target.output-path",<br>
>> > SETTING_MSG("target.output-path"),<br>
>> > - substrs=['target.output-path (file) =<br>
>> > "stdout.txt"'])<br>
>> > -<br>
>> > - self.runCmd("run", RUN_SUCCEEDED)<br>
>> > -<br>
>> > - if lldb.remote_platform:<br>
>> > - self.runCmd('platform get-file "stderr.txt" "stderr.txt"')<br>
>> > - self.runCmd('platform get-file "stdout.txt" "stdout.txt"')<br>
>> > -<br>
>> > - # The 'stderr.txt' file should now exist.<br>
>> > - self.assertTrue(os.path.isfile("stderr.txt"),<br>
>> > - "'stderr.txt' exists due to<br>
>> > target.error-path.")<br>
>> > + substrs=['target.output-path (file)',<br>
>> > 'stdout.txt"'])<br>
>> ><br>
>> > - # Read the output file produced by running the program.<br>
>> > - with open('stderr.txt', 'r') as f:<br>
>> > - output = f.read()<br>
>> > + self.runCmd("process launch --working-dir<br>
>> > '{0}'".format(self.get_process_working_directory()),<br>
>> > + RUN_SUCCEEDED)<br>
>> ><br>
>> > + output = lldbutil.read_file_from_process_wd(self, "stderr.txt")<br>
>> > message = "This message should go to standard error."<br>
>> > if lldbplatformutil.hasChattyStderr(self):<br>
>> > self.expect(output, exe=False, substrs=[message])<br>
>> > else:<br>
>> > self.expect(output, exe=False, startstr=message)<br>
>> ><br>
>> > - # The 'stdout.txt' file should now exist.<br>
>> > - self.assertTrue(os.path.isfile("stdout.txt"),<br>
>> > - "'stdout.txt' exists due to<br>
>> > target.output-path.")<br>
>> > -<br>
>> > - # Read the output file produced by running the program.<br>
>> > - with open('stdout.txt', 'r') as f:<br>
>> > - output = f.read()<br>
>> > -<br>
>> > + output = lldbutil.read_file_from_process_wd(self, "stdout.txt")<br>
>> > self.expect(output, exe=False,<br>
>> > startstr="This message should go to standard out.")<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_print_dictionary_setting(self):<br>
>> > self.runCmd("settings clear target.env-vars")<br>
>> > self.runCmd("settings set target.env-vars<br>
>> > [\"MY_VAR\"]=some-value")<br>
>> > @@ -351,7 +319,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > substrs=["MY_VAR=some-value"])<br>
>> > self.runCmd("settings clear target.env-vars")<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_print_array_setting(self):<br>
>> > self.runCmd("settings clear target.run-args")<br>
>> > self.runCmd("settings set target.run-args gobbledy-gook")<br>
>> > @@ -359,7 +326,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > substrs=['[0]: "gobbledy-gook"'])<br>
>> > self.runCmd("settings clear target.run-args")<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_settings_with_quotes(self):<br>
>> > self.runCmd("settings clear target.run-args")<br>
>> > self.runCmd("settings set target.run-args a b c")<br>
>> > @@ -392,7 +358,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > 'thread-format (format-string) = "abc def "')<br>
>> > self.runCmd('settings clear thread-format')<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_settings_with_trailing_whitespace(self):<br>
>> ><br>
>> > # boolean<br>
>> > @@ -517,7 +482,6 @@ class SettingsCommandTestCase(TestBase):<br>
>> > substrs=['disassembly-format (format-string) = "foo<br>
>> > "'])<br>
>> > self.runCmd("settings clear disassembly-format", check=False)<br>
>> ><br>
>> > - @no_debug_info_test<br>
>> > def test_all_settings_exist(self):<br>
>> > self.expect("settings show",<br>
>> > substrs=["auto-confirm",<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -7,6 +7,7 @@ from __future__ import print_function<br>
>> ><br>
>> > import os<br>
>> > import lldb<br>
>> > +import six<br>
>> > from lldbsuite.test.decorators import *<br>
>> > from lldbsuite.test.lldbtest import *<br>
>> > from lldbsuite.test import lldbutil<br>
>> > @@ -58,13 +59,10 @@ class TestSTTYBeforeAndAfter(TestBase):<br>
>> > child.expect(expect_prompt)<br>
>> ><br>
>> > # Turn on loggings for input/output to/from the child.<br>
>> > - with open('child_send1.txt', 'w') as f_send1:<br>
>> > - with open('child_read1.txt', 'w') as f_read1:<br>
>> > - child.logfile_send = f_send1<br>
>> > - child.logfile_read = f_read1<br>
>> > -<br>
>> > - child.sendline('stty -a')<br>
>> > - child.expect(expect_prompt)<br>
>> > + child.logfile_send = child_send1 = six.StringIO()<br>
>> > + child.logfile_read = child_read1 = six.StringIO()<br>
>> > + child.sendline('stty -a')<br>
>> > + child.expect(expect_prompt)<br>
>> ><br>
>> > # Now that the stage1 logging is done, restore logfile to None<br>
>> > to<br>
>> > # stop further logging.<br>
>> > @@ -79,43 +77,30 @@ class TestSTTYBeforeAndAfter(TestBase):<br>
>> > child.sendline('quit')<br>
>> > child.expect(expect_prompt)<br>
>> ><br>
>> > - with open('child_send2.txt', 'w') as f_send2:<br>
>> > - with open('child_read2.txt', 'w') as f_read2:<br>
>> > - child.logfile_send = f_send2<br>
>> > - child.logfile_read = f_read2<br>
>> > -<br>
>> > - child.sendline('stty -a')<br>
>> > - child.expect(expect_prompt)<br>
>> > + child.logfile_send = child_send2 = six.StringIO()<br>
>> > + child.logfile_read = child_read2 = six.StringIO()<br>
>> > + child.sendline('stty -a')<br>
>> > + child.expect(expect_prompt)<br>
>> ><br>
>> > - child.sendline('exit')<br>
>> > + child.sendline('exit')<br>
>> ><br>
>> > # Now that the stage2 logging is done, restore logfile to None<br>
>> > to<br>
>> > # stop further logging.<br>
>> > child.logfile_send = None<br>
>> > child.logfile_read = None<br>
>> ><br>
>> > - with open('child_send1.txt', 'r') as fs:<br>
>> > - if self.TraceOn():<br>
>> > - print("\n\nContents of child_send1.txt:")<br>
>> > - print(fs.read())<br>
>> > - with open('child_read1.txt', 'r') as fr:<br>
>> > - from_child1 = fr.read()<br>
>> > - if self.TraceOn():<br>
>> > - print("\n\nContents of child_read1.txt:")<br>
>> > - print(from_child1)<br>
>> > -<br>
>> > - with open('child_send2.txt', 'r') as fs:<br>
>> > - if self.TraceOn():<br>
>> > - print("\n\nContents of child_send2.txt:")<br>
>> > - print(fs.read())<br>
>> > - with open('child_read2.txt', 'r') as fr:<br>
>> > - from_child2 = fr.read()<br>
>> > - if self.TraceOn():<br>
>> > - print("\n\nContents of child_read2.txt:")<br>
>> > - print(from_child2)<br>
>> > + if self.TraceOn():<br>
>> > + print("\n\nContents of child_send1:")<br>
>> > + print(child_send1.getvalue())<br>
>> > + print("\n\nContents of child_read1:")<br>
>> > + print(child_read1.getvalue())<br>
>> > + print("\n\nContents of child_send2:")<br>
>> > + print(child_send2.getvalue())<br>
>> > + print("\n\nContents of child_read2:")<br>
>> > + print(child_read2.getvalue())<br>
>> ><br>
>> > - stty_output1_lines = from_child1.splitlines()<br>
>> > - stty_output2_lines = from_child2.splitlines()<br>
>> > + stty_output1_lines = child_read1.getvalue().splitlines()<br>
>> > + stty_output2_lines = child_read2.getvalue().splitlines()<br>
>> > zipped = list(zip(stty_output1_lines, stty_output2_lines))<br>
>> > for tuple in zipped:<br>
>> > if self.TraceOn():<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py Thu<br>
>> > Mar 15 06:47:09 2018<br>
>> > @@ -59,7 +59,7 @@ class MiFileTestCase(lldbmi_testcase.MiT<br>
>> ><br>
>> > # Test that -file-exec-and-symbols works for relative path<br>
>> > import os<br>
>> > - path = os.path.relpath(self.myexe)<br>
>> > + path = os.path.relpath(self.myexe, self.getBuildDir())<br>
>> > self.runCmd("-file-exec-and-symbols %s" % path)<br>
>> > self.expect("\^done")<br>
>> ><br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -44,7 +44,7 @@ class MiTestCaseBase(Base):<br>
>> > def spawnLldbMi(self, args=None):<br>
>> > import pexpect<br>
>> > self.child = pexpect.spawn("%s --interpreter %s" % (<br>
>> > - self.lldbMiExec, args if args else ""))<br>
>> > + self.lldbMiExec, args if args else ""),<br>
>> > cwd=self.getBuildDir())<br>
>> > self.child.setecho(True)<br>
>> > self.mylog = self.getBuildArtifact("child.log")<br>
>> > self.child.logfile_read = open(self.mylog, "w")<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -94,7 +94,7 @@ class MiStartupOptionsTestCase(lldbmi_te<br>
>> > """Test that 'lldb-mi --interpreter %s' loads executable which<br>
>> > is specified via relative path."""<br>
>> ><br>
>> > # Prepare path to executable<br>
>> > - path = os.path.relpath(self.myexe)<br>
>> > + path = os.path.relpath(self.myexe, self.getBuildDir())<br>
>> > self.spawnLldbMi(args="%s" % path)<br>
>> ><br>
>> > # Test that the executable is loaded when file was specified<br>
>> > using<br>
>> > @@ -258,7 +258,7 @@ class MiStartupOptionsTestCase(lldbmi_te<br>
>> > def test_lldbmi_log_option(self):<br>
>> > """Test that 'lldb-mi --log' creates a log file in the current<br>
>> > directory."""<br>
>> ><br>
>> > - logDirectory = "."<br>
>> > + logDirectory = self.getBuildDir()<br>
>> > self.spawnLldbMi(args="%s --log" % self.myexe)<br>
>> ><br>
>> > # Test that the executable is loaded when file was specified<br>
>> ><br>
>> > Modified:<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py<br>
>> > URL:<br>
>> > <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=327625&r1=327624&r2=327625&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=327625&r1=327624&r2=327625&view=diff</a><br>
>> ><br>
>> > ==============================================================================<br>
>> > ---<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py<br>
>> > (original)<br>
>> > +++<br>
>> > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py<br>
>> > Thu Mar 15 06:47:09 2018<br>
>> > @@ -47,7 +47,7 @@ class MiSyntaxTestCase(lldbmi_testcase.M<br>
>> > """Test that 'lldb-mi --interpreter' handles complicated<br>
>> > strings."""<br>
>> ><br>
>> > # Create an alias for myexe<br>
>> > - complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name"<br>
>> > + complicated_myexe = self.getBuildArtifact("C--mpl-x file's`s<br>
>> > @#$%^&*()_+-={}[]| name")<br>
>> > os.symlink(self.myexe, complicated_myexe)<br>
>> > self.addTearDownHook(lambda: os.unlink(complicated_myexe))<br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > lldb-commits mailing list<br>
>> > <a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
>> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>