diff --git a/test/test.py b/test/test.py index bc30d5f8a..a89aa0a7b 100644 --- a/test/test.py +++ b/test/test.py @@ -69,9 +69,10 @@ class State: eqLog = None class Result: - def __init__(self, snapshot, failure): + def __init__(self, snapshot, failure, page): self.snapshot = snapshot self.failure = failure + self.page = page class TestServer(SocketServer.TCPServer): allow_reuse_address = True @@ -122,10 +123,20 @@ class PDFTestHandler(BaseHTTPRequestHandler): result = json.loads(self.rfile.read(numBytes)) browser, id, failure, round, page, snapshot = result['browser'], result['id'], result['failure'], result['round'], result['page'], result['snapshot'] taskResults = State.taskResults[browser][id] - taskResults[round].append(Result(snapshot, failure)) - assert len(taskResults[round]) == page + taskResults[round].append(Result(snapshot, failure, page)) - if result['taskDone']: + def isTaskDone(): + numPages = result["numPages"] + rounds = State.manifest[id]["rounds"] + for round in range(0,rounds): + if len(taskResults[round]) < numPages: + return False + return True + + if isTaskDone(): + # sort the results since they sometimes come in out of order + for results in taskResults: + results.sort(key=lambda result: result.page) check(State.manifest[id], taskResults, browser) # Please oh please GC this ... del State.taskResults[browser][id] diff --git a/test/test_slave.html b/test/test_slave.html index 1053025e1..03982bbb5 100644 --- a/test/test_slave.html +++ b/test/test_slave.html @@ -139,31 +139,41 @@ function snapshotCurrentPage(gfx) { } } - currentTask.taskDone = (currentTask.pageNum == pdfDoc.numPages - && (1 + currentTask.round) == currentTask.rounds); sendTaskResult(canvas.toDataURL("image/png")); log("done"+ (failure ? " (failed!)" : "") +"\n"); - ++currentTask.pageNum, nextPage(); -} - -function done() { - log("Done!\n"); + // Set up the next request + backoff = (inFlightRequests > 0) ? inFlightRequests * 10 : 0; setTimeout(function() { - document.body.innerHTML = "Tests are finished.
Inflight requests: