Title: [234130] trunk/Tools
- Revision
- 234130
- Author
- [email protected]
- Date
- 2018-07-23 19:18:12 -0700 (Mon, 23 Jul 2018)
Log Message
webkitpy.port.server_process_unittest.TestServerProcess.test_basic failed on Windows Python
https://bugs.webkit.org/show_bug.cgi?id=187581
Reviewed by Daniel Bates.
There are two failures in this test case:
1. proc.poll() doesn't return 0.
2. stderr is not output.
For failure #1, this is expected. the process should not exit at
the time. proc.poll() should return None because the process is
still alive.
This change added a new test to check proc.poll() becomes 0 after
the process successfully exits.
For failure #2, stderr is not flushed even though stdout is
flushed. This change uses '-u' command switch to force stdin,
stdout and stderr to be totally unbuffered.
* Scripts/webkitpy/port/server_process_unittest.py:
(TestServerProcess.test_basic): Added -u command switch. Do not
flush stdout. Removed the special condition for Windows. Add a new
test to check proc.poll() returns 0.
(TestServerProcess.test_process_crashing): Added -u command
switch. Do not flush stdout.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (234129 => 234130)
--- trunk/Tools/ChangeLog 2018-07-24 01:35:47 UTC (rev 234129)
+++ trunk/Tools/ChangeLog 2018-07-24 02:18:12 UTC (rev 234130)
@@ -1,3 +1,32 @@
+2018-07-23 Fujii Hironori <[email protected]>
+
+ webkitpy.port.server_process_unittest.TestServerProcess.test_basic failed on Windows Python
+ https://bugs.webkit.org/show_bug.cgi?id=187581
+
+ Reviewed by Daniel Bates.
+
+ There are two failures in this test case:
+ 1. proc.poll() doesn't return 0.
+ 2. stderr is not output.
+
+ For failure #1, this is expected. the process should not exit at
+ the time. proc.poll() should return None because the process is
+ still alive.
+
+ This change added a new test to check proc.poll() becomes 0 after
+ the process successfully exits.
+
+ For failure #2, stderr is not flushed even though stdout is
+ flushed. This change uses '-u' command switch to force stdin,
+ stdout and stderr to be totally unbuffered.
+
+ * Scripts/webkitpy/port/server_process_unittest.py:
+ (TestServerProcess.test_basic): Added -u command switch. Do not
+ flush stdout. Removed the special condition for Windows. Add a new
+ test to check proc.poll() returns 0.
+ (TestServerProcess.test_process_crashing): Added -u command
+ switch. Do not flush stdout.
+
2018-07-23 Ross Kirsling <[email protected]>
WTF::StringView::split should have an allowEmptyEntries flag
Modified: trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py (234129 => 234130)
--- trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py 2018-07-24 01:35:47 UTC (rev 234129)
+++ trunk/Tools/Scripts/webkitpy/port/server_process_unittest.py 2018-07-24 02:18:12 UTC (rev 234130)
@@ -99,7 +99,8 @@
class TestServerProcess(unittest.TestCase):
def test_basic(self):
- cmd = [sys.executable, '-c', 'import sys; print "stdout"; sys.stdout.flush(); print >>sys.stderr, "stderr"; sys.stdin.readline();']
+ # Give -u switch to force stdout and stderr to be unbuffered for Windows
+ cmd = [sys.executable, '-uc', 'import sys; print "stdout"; print >>sys.stderr, "stderr"; sys.stdin.readline();']
host = SystemHost()
factory = PortFactory(host)
port = factory.get()
@@ -107,10 +108,7 @@
proc = server_process.ServerProcess(port, 'python', cmd)
proc.write('')
- if sys.platform.startswith('win'):
- self.assertEqual(proc.poll(), 0)
- else:
- self.assertEqual(proc.poll(), None)
+ self.assertEqual(proc.poll(), None)
self.assertFalse(proc.has_crashed())
# check that doing a read after an expired deadline returns
@@ -125,6 +123,9 @@
self.assertEqual(line.strip(), "stderr")
proc.write('End\n')
+ time.sleep(0.1) # Give process a moment to close.
+ self.assertEqual(proc.poll(), 0)
+
proc.stop(0)
def test_read_after_process_exits(self):
@@ -146,7 +147,8 @@
proc.stop(0)
def test_process_crashing(self):
- cmd = [sys.executable, '-c', 'import sys; print "stdout 1"; print "stdout 2"; print "stdout 3"; sys.stdout.flush(); sys.stdin.readline(); sys.exit(1);']
+ # Give -u switch to force stdout to be unbuffered for Windows
+ cmd = [sys.executable, '-uc', 'import sys; print "stdout 1"; print "stdout 2"; print "stdout 3"; sys.stdin.readline(); sys.exit(1);']
host = SystemHost()
factory = PortFactory(host)
port = factory.get()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes