[Lldb-commits] [PATCH] D52498: [lldb-mi] Fix bugs in target-select-so-path.test
Alexander Polyakov via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 25 07:55:11 PDT 2018
apolyakov created this revision.
apolyakov added reviewers: teemperor, labath, tatyana-krasnukha, aprantl.
Herald added a subscriber: ki.stfu.
This patch fixes hanging of the test in case of using python3, changes callback function that will be called if the timer ends;
Also, the test didn't work properly since it didn't contain a call of filecheck_proc.communicate(), that means that filecheck didn't run and its return code was equal to 0 in all cases.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D52498
Files:
lit/tools/lldb-mi/target/inputs/target-select-so-path.py
Index: lit/tools/lldb-mi/target/inputs/target-select-so-path.py
===================================================================
--- lit/tools/lldb-mi/target/inputs/target-select-so-path.py
+++ lit/tools/lldb-mi/target/inputs/target-select-so-path.py
@@ -9,22 +9,26 @@
hostname = 'localhost'
(r, w) = os.pipe()
+kwargs = {}
+if sys.version_info >= (3,0):
+ kwargs['pass_fds'] = [w]
+
args = sys.argv
# Get debugserver, lldb-mi and FileCheck executables' paths with arguments.
debugserver = ' '.join([args[1], '--pipe', str(w), hostname + ':0'])
lldbmi = args[2]
test_file = args[3]
filecheck = 'FileCheck ' + test_file
# Run debugserver, lldb-mi and FileCheck.
-debugserver_proc = subprocess.Popen(debugserver.split())
+debugserver_proc = subprocess.Popen(debugserver.split(), **kwargs)
lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, shell=True)
filecheck_proc = subprocess.Popen(filecheck, stdin=subprocess.PIPE,
shell=True)
timeout_sec = 30
-timer = Timer(timeout_sec, lldbmi_proc.kill)
+timer = Timer(timeout_sec, exit, [filecheck_proc.returncode])
try:
timer.start()
@@ -37,9 +41,10 @@
with open(test_file, 'r') as f:
# Replace '$PORT' with a free port number and pass
# test's content to lldb-mi.
- lldbmi_proc.stdin.write(f.read().replace('$PORT', port))
+ lldbmi_proc.stdin.write(f.read().replace('$PORT', port).encode('utf-8'))
out, err = lldbmi_proc.communicate()
filecheck_proc.stdin.write(out)
+ filecheck_proc.communicate()
finally:
timer.cancel()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52498.166912.patch
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180925/a73bef18/attachment.bin>
More information about the lldb-commits
mailing list