Fix run_dromaeo.py (#33239)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-08-28 21:03:42 +02:00 committed by GitHub
parent b2a9184ddc
commit c69acd1848
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 13 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
/python/_venv*
/python/tidy/servo_tidy.egg-info
/tests/wpt/sync
/tests/dromaeo/dromaeo
*.pkl
*.pyc
*.swp

View file

@ -4,13 +4,13 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from http.server import HTTPServer, SimpleHTTPRequestHandler
import os
import subprocess
import sys
import BaseHTTPServer
import SimpleHTTPServer
import urlparse
import urllib
import json
import urllib.parse
# Port to run the HTTP server on for Dromaeo.
@ -29,16 +29,19 @@ def print_usage():
print("USAGE: {0} tests servo_binary dromaeo_base_dir".format(sys.argv[0]))
post_data = None
# Handle the POST at the end
class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
class RequestHandler(SimpleHTTPRequestHandler):
def do_POST(self):
global post_data
self.send_response(200)
self.end_headers()
self.wfile.write("<HTML>POST OK.<BR><BR>")
length = int(self.headers.getheader('content-length'))
parameters = urlparse.parse_qs(self.rfile.read(length))
self.server.got_post = True
self.server.post_data = parameters['data']
self.wfile.write(b"<HTML>POST OK.<BR><BR>")
length = int(self.headers.get('content-length'))
parameters = urllib.parse.parse_qs(self.rfile.read(length))
post_data = parameters[b'data']
def log_message(self, format, *args):
return
@ -57,14 +60,13 @@ if __name__ == '__main__':
sys.exit(1)
# Start the test server
server = BaseHTTPServer.HTTPServer(('', TEST_SERVER_PORT), RequestHandler)
server = HTTPServer(('', TEST_SERVER_PORT), RequestHandler)
print("Testing Dromaeo on Servo!")
proc = run_servo(servo_exe, tests)
server.got_post = False
while not server.got_post:
while not post_data:
server.handle_request()
data = json.loads(server.post_data[0])
data = json.loads(post_data[0])
number = 0
length = 0
for test in data: