<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12688] CalendarServer/trunk/txweb2/dav/test</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12688">12688</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-02-13 11:51:17 -0800 (Thu, 13 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add some debug logging to help diagnose a buildbot test issue.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktxweb2davtesttest_pipelinepy">CalendarServer/trunk/txweb2/dav/test/test_pipeline.py</a></li>
<li><a href="#CalendarServertrunktxweb2davtesttworequest_clientpy">CalendarServer/trunk/txweb2/dav/test/tworequest_client.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktxweb2davtesttest_pipelinepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txweb2/dav/test/test_pipeline.py (12687 => 12688)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txweb2/dav/test/test_pipeline.py        2014-02-13 02:38:16 UTC (rev 12687)
+++ CalendarServer/trunk/txweb2/dav/test/test_pipeline.py        2014-02-13 19:51:17 UTC (rev 12688)
</span><span class="lines">@@ -7,10 +7,10 @@
</span><span class="cx"> # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
</span><span class="cx"> # copies of the Software, and to permit persons to whom the Software is
</span><span class="cx"> # furnished to do so, subject to the following conditions:
</span><del>-# 
</del><ins>+#
</ins><span class="cx"> # The above copyright notice and this permission notice shall be included in all
</span><span class="cx"> # copies or substantial portions of the Software.
</span><del>-# 
</del><ins>+#
</ins><span class="cx"> # THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
</span><span class="cx"> # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
</span><span class="cx"> # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
</span><span class="lines">@@ -21,8 +21,10 @@
</span><span class="cx"> #
</span><span class="cx"> # DRI: Wilfredo Sanchez, wsanchez@apple.com
</span><span class="cx"> ##
</span><del>-import sys, os
</del><span class="cx"> 
</span><ins>+import os
+import sys
+
</ins><span class="cx"> from twisted.internet import utils
</span><span class="cx"> from txweb2.test import test_server
</span><span class="cx"> from txweb2 import resource
</span><span class="lines">@@ -39,24 +41,29 @@
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     class TestResource(resource.LeafResource):
</span><span class="cx">         def render(self, req):
</span><del>-            return http.Response(stream=&quot;Host:%s, Path:%s&quot;%(req.host, req.path))
-            
</del><ins>+            return http.Response(stream=&quot;Host:%s, Path:%s&quot; % (req.host, req.path))
+
+
</ins><span class="cx">     def setUp(self):
</span><span class="cx">         self.root = self.TestResource()
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def chanrequest(self, root, uri, length, headers, method, version, prepath, content):
</span><span class="cx">         self.cr = super(Pipeline, self).chanrequest(root, uri, length, headers, method, version, prepath, content)
</span><span class="cx">         return self.cr
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def test_root(self):
</span><del>-        
</del><ins>+
</ins><span class="cx">         def _testStreamRead(x):
</span><span class="cx">             self.assertTrue(self.cr.request.stream.length == 0)
</span><span class="cx"> 
</span><span class="cx">         return self.assertResponse(
</span><del>-            (self.root, 'http://host/path', {&quot;content-type&quot;:&quot;text/plain&quot;,}, &quot;PUT&quot;, None, '', &quot;This is some text.&quot;),
</del><ins>+            (self.root, 'http://host/path', {&quot;content-type&quot;: &quot;text/plain&quot;, }, &quot;PUT&quot;, None, '', &quot;This is some text.&quot;),
</ins><span class="cx">             (405, {}, None)).addCallback(_testStreamRead)
</span><span class="cx"> 
</span><ins>+
+
</ins><span class="cx"> class SSLPipeline(test_http.SSLServerTest):
</span><span class="cx"> 
</span><span class="cx">     @deferredGenerator
</span><span class="lines">@@ -66,7 +73,8 @@
</span><span class="cx">         d = waitForDeferred(utils.getProcessOutputAndValue(sys.executable,
</span><span class="cx">                                                            args=args,
</span><span class="cx">                                                            env=os.environ))
</span><del>-        yield d; out,err,code = d.getResult()
-
</del><ins>+        yield d
+        out, err, code = d.getResult()
+        print err
</ins><span class="cx">         self.assertEquals(code, 0, &quot;Error output:\n%s&quot; % (err,))
</span><span class="cx">         self.assertEquals(out, &quot;HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\nHTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\n&quot;)
</span></span></pre></div>
<a id="CalendarServertrunktxweb2davtesttworequest_clientpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txweb2/dav/test/tworequest_client.py (12687 => 12688)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txweb2/dav/test/tworequest_client.py        2014-02-13 02:38:16 UTC (rev 12687)
+++ CalendarServer/trunk/txweb2/dav/test/tworequest_client.py        2014-02-13 19:51:17 UTC (rev 12688)
</span><span class="lines">@@ -1,4 +1,6 @@
</span><del>-import socket, sys
</del><ins>+import socket
+import sys
+import time
</ins><span class="cx"> 
</span><span class="cx"> test_type = sys.argv[1]
</span><span class="cx"> port = int(sys.argv[2])
</span><span class="lines">@@ -10,38 +12,39 @@
</span><span class="cx"> 
</span><span class="cx"> if socket_type == 'ssl':
</span><span class="cx">     s2 = socket.ssl(s)
</span><del>-    send=s2.write
-    recv=s2.read
</del><ins>+    send = s2.write
+    recv = s2.read
</ins><span class="cx"> else:
</span><del>-    send=s.send
-    recv=s.recv
-    
-print &gt;&gt; sys.stderr, &quot;&gt;&gt; Making %s request to port %d&quot; % (socket_type, port)
</del><ins>+    send = s.send
+    recv = s.recv
</ins><span class="cx"> 
</span><ins>+print &gt;&gt; sys.stderr, &quot;\n&gt;&gt; Making %s request to port %d&quot; % (socket_type, port)
+
</ins><span class="cx"> send(&quot;PUT /forbidden HTTP/1.1\r\n&quot;)
</span><span class="cx"> send(&quot;Host: localhost\r\n&quot;)
</span><span class="cx"> 
</span><del>-print &gt;&gt; sys.stderr, &quot;&gt;&gt; Sending lots of data&quot;
</del><ins>+print &gt;&gt; sys.stderr, &quot;&gt;&gt; Sending lots of data: t={}&quot;.format(time.time())
</ins><span class="cx"> send(&quot;Content-Length: 100\r\n\r\n&quot;)
</span><del>-send(&quot;X&quot;*100)
</del><ins>+send(&quot;X&quot; * 100)
</ins><span class="cx"> 
</span><span class="cx"> send(&quot;PUT /forbidden HTTP/1.1\r\n&quot;)
</span><span class="cx"> send(&quot;Host: localhost\r\n&quot;)
</span><span class="cx"> 
</span><del>-print &gt;&gt; sys.stderr, &quot;&gt;&gt; Sending lots of data&quot;
</del><ins>+print &gt;&gt; sys.stderr, &quot;&gt;&gt; Sending lots of data: t={}&quot;.format(time.time())
</ins><span class="cx"> send(&quot;Content-Length: 100\r\n\r\n&quot;)
</span><del>-send(&quot;X&quot;*100)
</del><ins>+send(&quot;X&quot; * 100)
</ins><span class="cx"> 
</span><span class="cx"> #import time
</span><span class="cx"> #time.sleep(5)
</span><del>-print &gt;&gt; sys.stderr, &quot;&gt;&gt; Getting data&quot;
-data=''
</del><ins>+print &gt;&gt; sys.stderr, &quot;&gt;&gt; Getting data: t={}&quot;.format(time.time())
+data = ''
</ins><span class="cx"> while len(data) &lt; 299999:
</span><span class="cx">     try:
</span><del>-        x=recv(10000)
</del><ins>+        x = recv(10000)
</ins><span class="cx">     except:
</span><span class="cx">         break
</span><span class="cx">     if x == '':
</span><span class="cx">         break
</span><del>-    data+=x
</del><ins>+    data += x
+print &gt;&gt; sys.stderr, &quot;&gt;&gt; Done data: t={}&quot;.format(time.time())
</ins><span class="cx"> sys.stdout.write(data)
</span></span></pre>
</div>
</div>

</body>
</html>