Skip to content

Commit

Permalink
update eof for windows (#36963)
Browse files Browse the repository at this point in the history
* update eof for windows

* check equals to win32 to match format of other windows checkers

* use plain text string instead of encoded + consider alternative case that rwt already considers

* don't use linesep as it's not supported across platforms

* don't use linesep as it's not supported across platforms

Co-authored-by: Nihar Damarasingu <[email protected]>
  • Loading branch information
nihardamar and nihardamar authored Nov 21, 2022
1 parent 56d76b7 commit c6addf5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/wptrunner/wptrunner/executors/executorcontentshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from time import time
from queue import Empty
from base64 import b64encode
from os import linesep
import json


Expand Down Expand Up @@ -41,7 +40,7 @@ class ContentShellTestPart(ProtocolPart):
https://chromium.googlesource.com/chromium/src.git/+/HEAD/content/web_test/browser/test_info_extractor.h
"""
name = "content_shell_test"
eof_marker = "#EOF" + linesep # Marker sent by content_shell after blocks.
eof_marker = '#EOF\n' # Marker sent by content_shell after blocks.

def __init__(self, parent):
super().__init__(parent)
Expand All @@ -67,7 +66,7 @@ def do_test(self, command, timeout=None):
def _send_command(self, command):
"""Sends a single `command`, i.e. a URL to open, to content_shell.
"""
self.stdin_queue.put((command + linesep).encode("utf-8"))
self.stdin_queue.put((command + "\n").encode("utf-8"))

def _read_block(self, deadline=None):
"""Tries to read a single block of content from stdout before the `deadline`.
Expand Down Expand Up @@ -95,6 +94,10 @@ def _read_text_block(self, deadline=None):
if line.endswith(self.eof_marker):
result += line[:-len(self.eof_marker)]
break
elif line.endswith('#EOF\r\n'):
result += line[:-len('#EOF\r\n')]
self.logger.warning('Got a CRLF-terminated #EOF - this is a driver bug.')
break

result += line

Expand Down

0 comments on commit c6addf5

Please sign in to comment.