mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 480077 - automation.py.in : additional fix to bug 472706 for |runApp()| return value(s); (Bv1a) Replace external times by internal duration ++; r=jwalden+bmo
This commit is contained in:
parent
97d6e4aab9
commit
5dd75974c9
@ -120,7 +120,7 @@ class Process(subprocess.Popen):
|
||||
try:
|
||||
subprocess.Popen(["kill", "-f", pid]).wait()
|
||||
except:
|
||||
log.info("TEST-UNEXPECTED-FAIL | Missing 'kill' utility to kill process with pid=%s. Kill it manually!", pid)
|
||||
log.info("TEST-UNEXPECTED-FAIL | (automation.py) | Missing 'kill' utility to kill process with pid=%s. Kill it manually!", pid)
|
||||
else:
|
||||
# Windows XP and later.
|
||||
subprocess.Popen(["taskkill", "/F", "/PID", pid]).wait()
|
||||
@ -408,22 +408,19 @@ def environment(env = None, xrePath = DIST_BIN):
|
||||
###############
|
||||
|
||||
def runApp(testURL, env, app, profileDir, extraArgs, runSSLTunnel = False, utilityPath = DIST_BIN, xrePath = DIST_BIN, certPath = CERTS_SRC_DIR):
|
||||
"Run the app, returning a tuple containing the status code and the time at which it was started."
|
||||
"Run the app, log the duration it took to execute, return the status code."
|
||||
|
||||
if IS_TEST_BUILD and runSSLTunnel:
|
||||
# create certificate database for the profile
|
||||
certificateStatus = fillCertificateDB(profileDir, certPath, utilityPath, xrePath)
|
||||
if certificateStatus != 0:
|
||||
log.info("TEST-UNEXPECTED FAIL | Certificate integration failed")
|
||||
log.info("TEST-UNEXPECTED FAIL | (automation.py) | Certificate integration failed")
|
||||
return certificateStatus
|
||||
|
||||
|
||||
# start ssltunnel to provide https:// URLs capability
|
||||
ssltunnel = os.path.join(utilityPath, "ssltunnel" + BIN_SUFFIX)
|
||||
ssltunnelProcess = Process([ssltunnel, os.path.join(profileDir, "ssltunnel.cfg")], env = environment(xrePath = xrePath))
|
||||
log.info("SSL tunnel pid: %d", ssltunnelProcess.pid)
|
||||
|
||||
"Run the app, returning the time at which it was started."
|
||||
# mark the start
|
||||
start = datetime.now()
|
||||
log.info("INFO | (automation.py) | SSL tunnel pid: %d", ssltunnelProcess.pid)
|
||||
|
||||
# now run with the profile we created
|
||||
cmd = app
|
||||
@ -447,17 +444,20 @@ def runApp(testURL, env, app, profileDir, extraArgs, runSSLTunnel = False, utili
|
||||
else:
|
||||
args.append((testURL))
|
||||
args.extend(extraArgs)
|
||||
|
||||
startTime = datetime.now()
|
||||
proc = Process([cmd] + args, env = environment(env), stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
|
||||
log.info("Application pid: %d", proc.pid)
|
||||
log.info("INFO | (automation.py) | Application pid: %d", proc.pid)
|
||||
line = proc.stdout.readline()
|
||||
while line != "":
|
||||
log.info(line.rstrip())
|
||||
line = proc.stdout.readline()
|
||||
status = proc.wait()
|
||||
if status != 0:
|
||||
log.info("TEST-UNEXPECTED-FAIL | Exited with code %d during test run", status)
|
||||
log.info("TEST-UNEXPECTED-FAIL | (automation.py) | Exited with code %d during test run", status)
|
||||
log.info("INFO | (automation.py) | Application ran for: %s", str(datetime.now() - startTime))
|
||||
|
||||
if IS_TEST_BUILD and runSSLTunnel:
|
||||
ssltunnelProcess.kill()
|
||||
|
||||
return (status, start)
|
||||
|
||||
return status
|
||||
|
@ -84,6 +84,6 @@ if __name__ == '__main__':
|
||||
|
||||
url = "http://localhost:%d/bloatcycle.html" % PORT
|
||||
appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
|
||||
(status, start) = automation.runApp(url, browserEnv, appPath,
|
||||
PROFILE_DIRECTORY, extraArgs)
|
||||
status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY,
|
||||
extraArgs)
|
||||
sys.exit(status)
|
||||
|
@ -64,7 +64,7 @@ if __name__ == '__main__':
|
||||
|
||||
automation.initializeProfile(PROFILE_DIRECTORY)
|
||||
browserEnv = dict(os.environ)
|
||||
|
||||
|
||||
# These variables are necessary for correct application startup; change
|
||||
# via the commandline at your own risk.
|
||||
browserEnv["NO_EM_RESTART"] = "1"
|
||||
@ -75,7 +75,5 @@ if __name__ == '__main__':
|
||||
|
||||
url = "http://localhost:%d/index.html" % PORT
|
||||
appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
|
||||
(status, start) = automation.runApp(url, browserEnv, appPath,
|
||||
PROFILE_DIRECTORY, {})
|
||||
status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY, {})
|
||||
sys.exit(status)
|
||||
|
||||
|
@ -85,7 +85,7 @@ def main():
|
||||
default = [],
|
||||
help = "copy specified files/dirs to testing profile")
|
||||
options, args = parser.parse_args()
|
||||
|
||||
|
||||
if len(args) != 1:
|
||||
print >>sys.stderr, "No reftest.list specified."
|
||||
sys.exit(1)
|
||||
@ -135,18 +135,16 @@ Are you executing $objdir/_tests/reftest/runreftest.py?""" \
|
||||
# run once with -silent to let the extension manager do its thing
|
||||
# and then exit the app
|
||||
log.info("REFTEST INFO | runreftest.py | Performing extension manager registration: start.\n")
|
||||
(status, start) = automation.runApp(None, browserEnv, options.app,
|
||||
profileDir,
|
||||
extraArgs = ["-silent"])
|
||||
status = automation.runApp(None, browserEnv, options.app, profileDir,
|
||||
extraArgs = ["-silent"])
|
||||
# We don't care to call |processLeakLog()| for this step.
|
||||
log.info("\nREFTEST INFO | runreftest.py | Performing extension manager registration: end.")
|
||||
|
||||
# then again to actually run reftest
|
||||
log.info("REFTEST INFO | runreftest.py | Running tests: start.\n")
|
||||
reftestlist = getFullPath(args[0])
|
||||
(status, start) = automation.runApp(None, browserEnv, options.app,
|
||||
profileDir,
|
||||
extraArgs = ["-reftest", reftestlist])
|
||||
status = automation.runApp(None, browserEnv, options.app, profileDir,
|
||||
extraArgs = ["-reftest", reftestlist])
|
||||
processLeakLog()
|
||||
log.info("\nREFTEST INFO | runreftest.py | Running tests: end.")
|
||||
finally:
|
||||
|
@ -394,12 +394,12 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
|
||||
if options.fatalAssertions:
|
||||
browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
|
||||
|
||||
(status, start) = automation.runApp(testURL, browserEnv, options.app,
|
||||
PROFILE_DIRECTORY, options.browserArgs,
|
||||
runSSLTunnel = True,
|
||||
utilityPath=options.utilityPath,
|
||||
xrePath=options.xrePath,
|
||||
certPath=options.certPath)
|
||||
status = automation.runApp(testURL, browserEnv, options.app,
|
||||
PROFILE_DIRECTORY, options.browserArgs,
|
||||
runSSLTunnel = True,
|
||||
utilityPath = options.utilityPath,
|
||||
xrePath = options.xrePath,
|
||||
certPath = options.certPath)
|
||||
|
||||
# Server's no longer needed, and perhaps more importantly, anything it might
|
||||
# spew to console shouldn't disrupt the leak information table we print next.
|
||||
@ -476,12 +476,6 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?"""
|
||||
log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | missing output line for total leaks!")
|
||||
leaks.close()
|
||||
|
||||
|
||||
# print test run times
|
||||
finish = datetime.now()
|
||||
log.info(" started: %s", str(start))
|
||||
log.info("finished: %s", str(finish))
|
||||
|
||||
# delete the profile and manifest
|
||||
os.remove(manifest)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user