1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/leaktest.py.in Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +#literal #!/usr/bin/python 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +import SimpleHTTPServer 1.11 +import SocketServer 1.12 +import threading 1.13 +import os 1.14 +import sys 1.15 +import logging 1.16 +from getopt import getopt 1.17 +from automation import Automation 1.18 + 1.19 +PORT = 8888 1.20 +SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0]))) 1.21 +PROFILE_DIRECTORY = os.path.abspath(os.path.join(SCRIPT_DIR, "./leakprofile")) 1.22 +os.chdir(SCRIPT_DIR) 1.23 + 1.24 +class EasyServer(SocketServer.TCPServer): 1.25 + allow_reuse_address = True 1.26 + 1.27 +if __name__ == '__main__': 1.28 + automation = Automation() 1.29 + DIST_BIN = os.path.join(SCRIPT_DIR, automation.DIST_BIN) 1.30 + opts, extraArgs = getopt(sys.argv[1:], 'l:') 1.31 + if len(opts) > 0: 1.32 + try: 1.33 + automation.log.addHandler(logging.FileHandler(opts[0][1], "w")) 1.34 + except: 1.35 + automation.log.info("Unable to open logfile " + opts[0][1] + \ 1.36 + "ONLY logging to stdout.") 1.37 + 1.38 + httpd = EasyServer(("", PORT), SimpleHTTPServer.SimpleHTTPRequestHandler) 1.39 + t = threading.Thread(target=httpd.serve_forever) 1.40 + t.setDaemon(True) 1.41 + t.start() 1.42 + 1.43 + automation.setServerInfo("localhost", PORT) 1.44 + 1.45 + # keep a profile reference so that it is not cleaned up immediately via __del__ 1.46 + profile = automation.initializeProfile(PROFILE_DIRECTORY) 1.47 + 1.48 + browserEnv = automation.environment() 1.49 + 1.50 + if not "XPCOM_DEBUG_BREAK" in browserEnv: 1.51 + browserEnv["XPCOM_DEBUG_BREAK"] = "stack" 1.52 + url = "http://localhost:%d/bloatcycle.html" % PORT 1.53 + appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP) 1.54 + status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY, 1.55 + extraArgs, timeout=1800) 1.56 + sys.exit(status)