|
|
@ -71,7 +71,6 @@ class State: |
|
|
|
remaining = 0 |
|
|
|
remaining = 0 |
|
|
|
results = { } |
|
|
|
results = { } |
|
|
|
done = False |
|
|
|
done = False |
|
|
|
masterMode = False |
|
|
|
|
|
|
|
numErrors = 0 |
|
|
|
numErrors = 0 |
|
|
|
numEqFailures = 0 |
|
|
|
numEqFailures = 0 |
|
|
|
numEqNoSnapshot = 0 |
|
|
|
numEqNoSnapshot = 0 |
|
|
@ -158,7 +157,8 @@ class PDFTestHandler(BaseHTTPRequestHandler): |
|
|
|
# sort the results since they sometimes come in out of order |
|
|
|
# sort the results since they sometimes come in out of order |
|
|
|
for results in taskResults: |
|
|
|
for results in taskResults: |
|
|
|
results.sort(key=lambda result: result.page) |
|
|
|
results.sort(key=lambda result: result.page) |
|
|
|
check(State.manifest[id], taskResults, browser) |
|
|
|
check(State.manifest[id], taskResults, browser, |
|
|
|
|
|
|
|
self.server.masterMode) |
|
|
|
# Please oh please GC this ... |
|
|
|
# Please oh please GC this ... |
|
|
|
del State.taskResults[browser][id] |
|
|
|
del State.taskResults[browser][id] |
|
|
|
State.remaining -= 1 |
|
|
|
State.remaining -= 1 |
|
|
@ -285,7 +285,6 @@ def setUp(options): |
|
|
|
# Only serve files from a pdf.js clone |
|
|
|
# Only serve files from a pdf.js clone |
|
|
|
assert not ANAL or os.path.isfile('../pdf.js') and os.path.isdir('../.git') |
|
|
|
assert not ANAL or os.path.isfile('../pdf.js') and os.path.isdir('../.git') |
|
|
|
|
|
|
|
|
|
|
|
State.masterMode = options.masterMode |
|
|
|
|
|
|
|
if options.masterMode and os.path.isdir(TMPDIR): |
|
|
|
if options.masterMode and os.path.isdir(TMPDIR): |
|
|
|
print 'Temporary snapshot dir tmp/ is still around.' |
|
|
|
print 'Temporary snapshot dir tmp/ is still around.' |
|
|
|
print 'tmp/ can be removed if it has nothing you need.' |
|
|
|
print 'tmp/ can be removed if it has nothing you need.' |
|
|
@ -341,7 +340,7 @@ def teardownBrowsers(browsers): |
|
|
|
print "Temp dir was ", b.tempDir |
|
|
|
print "Temp dir was ", b.tempDir |
|
|
|
print "Error:", sys.exc_info()[0] |
|
|
|
print "Error:", sys.exc_info()[0] |
|
|
|
|
|
|
|
|
|
|
|
def check(task, results, browser): |
|
|
|
def check(task, results, browser, masterMode): |
|
|
|
failed = False |
|
|
|
failed = False |
|
|
|
for r in xrange(len(results)): |
|
|
|
for r in xrange(len(results)): |
|
|
|
pageResults = results[r] |
|
|
|
pageResults = results[r] |
|
|
@ -360,7 +359,7 @@ def check(task, results, browser): |
|
|
|
|
|
|
|
|
|
|
|
kind = task['type'] |
|
|
|
kind = task['type'] |
|
|
|
if 'eq' == kind: |
|
|
|
if 'eq' == kind: |
|
|
|
checkEq(task, results, browser) |
|
|
|
checkEq(task, results, browser, masterMode) |
|
|
|
elif 'fbf' == kind: |
|
|
|
elif 'fbf' == kind: |
|
|
|
checkFBF(task, results, browser) |
|
|
|
checkFBF(task, results, browser) |
|
|
|
elif 'load' == kind: |
|
|
|
elif 'load' == kind: |
|
|
@ -369,7 +368,7 @@ def check(task, results, browser): |
|
|
|
assert 0 and 'Unknown test type' |
|
|
|
assert 0 and 'Unknown test type' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def checkEq(task, results, browser): |
|
|
|
def checkEq(task, results, browser, masterMode): |
|
|
|
pfx = os.path.join(REFDIR, sys.platform, browser, task['id']) |
|
|
|
pfx = os.path.join(REFDIR, sys.platform, browser, task['id']) |
|
|
|
results = results[0] |
|
|
|
results = results[0] |
|
|
|
taskId = task['id'] |
|
|
|
taskId = task['id'] |
|
|
@ -407,12 +406,12 @@ def checkEq(task, results, browser): |
|
|
|
passed = False |
|
|
|
passed = False |
|
|
|
State.numEqFailures += 1 |
|
|
|
State.numEqFailures += 1 |
|
|
|
|
|
|
|
|
|
|
|
if State.masterMode and (ref is None or not eq): |
|
|
|
if masterMode and (ref is None or not eq): |
|
|
|
tmpTaskDir = os.path.join(TMPDIR, sys.platform, browser, task['id']) |
|
|
|
tmpTaskDir = os.path.join(TMPDIR, sys.platform, browser, task['id']) |
|
|
|
try: |
|
|
|
try: |
|
|
|
os.makedirs(tmpTaskDir) |
|
|
|
os.makedirs(tmpTaskDir) |
|
|
|
except OSError, e: |
|
|
|
except OSError, e: |
|
|
|
pass |
|
|
|
print >>sys.stderr, 'Creating', tmpTaskDir, 'failed!' |
|
|
|
|
|
|
|
|
|
|
|
of = open(os.path.join(tmpTaskDir, str(page + 1)), 'w') |
|
|
|
of = open(os.path.join(tmpTaskDir, str(page + 1)), 'w') |
|
|
|
of.write(snapshot) |
|
|
|
of.write(snapshot) |
|
|
@ -522,6 +521,7 @@ def main(): |
|
|
|
sys.exit(1) |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
|
|
httpd = TestServer((SERVER_HOST, options.port), PDFTestHandler) |
|
|
|
httpd = TestServer((SERVER_HOST, options.port), PDFTestHandler) |
|
|
|
|
|
|
|
httpd.masterMode = options.masterMode |
|
|
|
httpd_thread = threading.Thread(target=httpd.serve_forever) |
|
|
|
httpd_thread = threading.Thread(target=httpd.serve_forever) |
|
|
|
httpd_thread.setDaemon(True) |
|
|
|
httpd_thread.setDaemon(True) |
|
|
|
httpd_thread.start() |
|
|
|
httpd_thread.start() |
|
|
|