Changeset 1670
- Timestamp:
- 07/21/08 13:41:06 (6 months ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/qa/base.py (modified) (5 diffs)
- cherokee/trunk/qa/run-tests.py (modified) (3 diffs)
- cherokee/trunk/qa/util.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r1665 r1670 1 2008-07-21 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * qa/run-tests.py (mainloop_iterator): Fixes a really nasty bug 4 that was making the QA sets to report weird errors. 5 1 6 2008-07-18 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 7 cherokee/trunk/qa/base.py
r1667 r1670 17 17 from conf import * 18 18 from util import * 19 20 DEFAULT_READ = 8192 19 21 20 22 def importfile(path): … … 41 43 42 44 def _initialize (self): 43 self.ssl = None 44 self.reply = "" # "200 OK".. 45 self.version = None # HTTP/x.y: 9, 0 or 1 46 self.reply_err = None # 200 45 self.ssl = None 46 self.reply = "" # "200 OK".. 47 self.version = None # HTTP/x.y: 9, 0 or 1 48 self.reply_err = None # 200 49 50 def _safe_read (self, s): 51 while True: 52 try: 53 if self.ssl: 54 return self.ssl.read (DEFAULT_READ) 55 else: 56 return s.recv (DEFAULT_READ) 57 except socket.error, (err, strerr): 58 if err == errno.EAGAIN or \ 59 err == errno.EWOULDBLOCK or \ 60 err == errno.EINPROGRESS: 61 continue 62 raise 47 63 48 64 def _do_request (self, port, ssl): … … 83 99 while True: 84 100 try: 85 if self.ssl: 86 d = self.ssl.read(8192) 87 else: 88 d = s.recv(8192) 89 except: 101 d = self._safe_read (s) 102 except Exception, e: 90 103 d = '' 91 104 … … 97 110 98 111 def _parse_output (self): 99 if (len(self.reply) == 0):112 if not len(self.reply): 100 113 raise Exception("Empty header") 101 102 lines = string.split(self.reply, "\n") 103 reply = lines[0] 104 114 115 # Protocol version 116 reply = self.reply.split('\r', 1)[0] 105 117 if reply[:8] == "HTTP/0.9": 106 118 self.version = 9 … … 112 124 raise Exception("Invalid header, len=%d: '%s'" % (len(reply), reply)) 113 125 126 # Error code 114 127 reply = reply[9:] 115 116 128 try: 117 129 self.reply_err = int (reply[:3]) 118 130 except: 119 131 raise Exception("Invalid header, version=%d len=%d: '%s'" % (self.version, len(reply), reply)) 120 121 return 0122 132 123 133 def _check_result_expected_item (self, item): cherokee/trunk/qa/run-tests.py
r1667 r1670 363 363 if not its_clean: 364 364 print e 365 print obj365 print_sec(obj) 366 366 clean_up() 367 367 sys.exit(1) … … 370 370 if not its_clean: 371 371 print MESSAGE_FAILED 372 print obj372 print_sec (obj) 373 373 clean_up() 374 374 sys.exit(1) … … 396 396 time.sleep(t) 397 397 398 thread.start_new_thread (mainloop_iterator, ( objs[:], False))398 thread.start_new_thread (mainloop_iterator, (copy.deepcopy(objs), False)) 399 399 400 400 # Execute the tests cherokee/trunk/qa/util.py
r1609 r1670 1 import os, sys, time, random 1 import os, sys, time, random, fcntl 2 2 3 from conf import * 3 4 … … 220 221 return cherokee_build_info_has ("Built-in", module) 221 222 223 def print_sec (content): 224 fcntl.flock (sys.stdout, fcntl.LOCK_EX) 225 print content 226 fcntl.flock (sys.stdout, fcntl.LOCK_UN)