Re: [Lldb-commits] [PATCH] D19510: Fix send and receive of ACK byte in test infrastructure for Python 3.5

2016-04-26 Thread Adrian McCarthy via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267562: Fix send and receive of ACK byte in test 
infrastructure for Python 3.5 (authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D19510?vs=54938=55005#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19510

Files:
  lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
  lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py

Index: lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
===
--- lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
+++ lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
@@ -59,8 +59,7 @@
 # the initiators of the socket to await this to ensure
 # that this end is up and running (and therefore already
 # into the async map).
-ack_bytes = bytearray()
-ack_bytes.append(chr(42))
+ack_bytes = b'*'
 file_object.send(ack_bytes)
 
 def deserialize_payload(self):
Index: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
===
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
@@ -40,9 +40,6 @@
 self.cleanup_func = cleanup_func
 
 
-SOCKET_ACK_BYTE_VALUE = b'*'  # ASCII for chr(42)
-
-
 def create_results_formatter(config):
 """Sets up a test results formatter.
 
@@ -78,7 +75,7 @@
 # listener socket gets spun up; otherwise,
 # we lose the test result info.
 read_bytes = sock.recv(1)
-if read_bytes is None or (len(read_bytes) < 1) or (read_bytes[0] != 
SOCKET_ACK_BYTE_VALUE):
+if read_bytes is None or (len(read_bytes) < 1) or (read_bytes != b'*'):
 raise Exception("listening socket did not respond with ack byte: 
response={}".format(read_bytes))
 
 return sock, lambda: socket_closer(sock)


Index: lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
===
--- lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
+++ lldb/trunk/packages/Python/lldbsuite/test_event/dotest_channels.py
@@ -59,8 +59,7 @@
 # the initiators of the socket to await this to ensure
 # that this end is up and running (and therefore already
 # into the async map).
-ack_bytes = bytearray()
-ack_bytes.append(chr(42))
+ack_bytes = b'*'
 file_object.send(ack_bytes)
 
 def deserialize_payload(self):
Index: lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
===
--- lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
+++ lldb/trunk/packages/Python/lldbsuite/test_event/formatter/__init__.py
@@ -40,9 +40,6 @@
 self.cleanup_func = cleanup_func
 
 
-SOCKET_ACK_BYTE_VALUE = b'*'  # ASCII for chr(42)
-
-
 def create_results_formatter(config):
 """Sets up a test results formatter.
 
@@ -78,7 +75,7 @@
 # listener socket gets spun up; otherwise,
 # we lose the test result info.
 read_bytes = sock.recv(1)
-if read_bytes is None or (len(read_bytes) < 1) or (read_bytes[0] != SOCKET_ACK_BYTE_VALUE):
+if read_bytes is None or (len(read_bytes) < 1) or (read_bytes != b'*'):
 raise Exception("listening socket did not respond with ack byte: response={}".format(read_bytes))
 
 return sock, lambda: socket_closer(sock)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D19510: Fix send and receive of ACK byte in test infrastructure for Python 3.5

2016-04-26 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

LGTM!


http://reviews.llvm.org/D19510



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D19510: Fix send and receive of ACK byte in test infrastructure for Python 3.5

2016-04-25 Thread Adrian McCarthy via lldb-commits
amccarth created this revision.
amccarth added a reviewer: tfiala.
amccarth added a subscriber: lldb-commits.

Python 3.5 is pickier about the distinction between chars and bytes (and 
strings and bytearrays) than Python 2.7.

The call to ack_bytes.append(chr(42)) was causing a type error to be thrown 
(during init, so we didn't see a proper stack trace).

I've used the b'*' syntax which creates a bytearray in Python 3 and a plain 
string in Python 2.  I believe this should work in Python 2, but I'm not in a 
position to test that.  If you want to try patching this in to your build to be 
sure, it would be appreciated.

http://reviews.llvm.org/D19510

Files:
  packages/Python/lldbsuite/test_event/dotest_channels.py
  packages/Python/lldbsuite/test_event/formatter/__init__.py

Index: packages/Python/lldbsuite/test_event/formatter/__init__.py
===
--- packages/Python/lldbsuite/test_event/formatter/__init__.py
+++ packages/Python/lldbsuite/test_event/formatter/__init__.py
@@ -40,9 +40,6 @@
 self.cleanup_func = cleanup_func
 
 
-SOCKET_ACK_BYTE_VALUE = b'*'  # ASCII for chr(42)
-
-
 def create_results_formatter(config):
 """Sets up a test results formatter.
 
@@ -78,7 +75,7 @@
 # listener socket gets spun up; otherwise,
 # we lose the test result info.
 read_bytes = sock.recv(1)
-if read_bytes is None or (len(read_bytes) < 1) or (read_bytes[0] != 
SOCKET_ACK_BYTE_VALUE):
+if read_bytes is None or (len(read_bytes) < 1) or (read_bytes != b'*'):
 raise Exception("listening socket did not respond with ack byte: 
response={}".format(read_bytes))
 
 return sock, lambda: socket_closer(sock)
Index: packages/Python/lldbsuite/test_event/dotest_channels.py
===
--- packages/Python/lldbsuite/test_event/dotest_channels.py
+++ packages/Python/lldbsuite/test_event/dotest_channels.py
@@ -59,8 +59,7 @@
 # the initiators of the socket to await this to ensure
 # that this end is up and running (and therefore already
 # into the async map).
-ack_bytes = bytearray()
-ack_bytes.append(chr(42))
+ack_bytes = b'*'
 file_object.send(ack_bytes)
 
 def deserialize_payload(self):


Index: packages/Python/lldbsuite/test_event/formatter/__init__.py
===
--- packages/Python/lldbsuite/test_event/formatter/__init__.py
+++ packages/Python/lldbsuite/test_event/formatter/__init__.py
@@ -40,9 +40,6 @@
 self.cleanup_func = cleanup_func
 
 
-SOCKET_ACK_BYTE_VALUE = b'*'  # ASCII for chr(42)
-
-
 def create_results_formatter(config):
 """Sets up a test results formatter.
 
@@ -78,7 +75,7 @@
 # listener socket gets spun up; otherwise,
 # we lose the test result info.
 read_bytes = sock.recv(1)
-if read_bytes is None or (len(read_bytes) < 1) or (read_bytes[0] != SOCKET_ACK_BYTE_VALUE):
+if read_bytes is None or (len(read_bytes) < 1) or (read_bytes != b'*'):
 raise Exception("listening socket did not respond with ack byte: response={}".format(read_bytes))
 
 return sock, lambda: socket_closer(sock)
Index: packages/Python/lldbsuite/test_event/dotest_channels.py
===
--- packages/Python/lldbsuite/test_event/dotest_channels.py
+++ packages/Python/lldbsuite/test_event/dotest_channels.py
@@ -59,8 +59,7 @@
 # the initiators of the socket to await this to ensure
 # that this end is up and running (and therefore already
 # into the async map).
-ack_bytes = bytearray()
-ack_bytes.append(chr(42))
+ack_bytes = b'*'
 file_object.send(ack_bytes)
 
 def deserialize_payload(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits