testing/marionette/update-smoketests/run-smoketests.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/usr/bin/env python
michael@0 2 #
michael@0 3 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6
michael@0 7 import argparse
michael@0 8 import os
michael@0 9 import sys
michael@0 10 import tempfile
michael@0 11
michael@0 12 from smoketest import *
michael@0 13
michael@0 14 def main():
michael@0 15 parser = argparse.ArgumentParser(prog="run-smoketests.py")
michael@0 16 parser.add_argument("--build-dir", required=True,
michael@0 17 help="directory that contains builds with build ID subdirectories")
michael@0 18 parser.add_argument("--run-dir", default=None,
michael@0 19 help="directory where partials and testvars are generated. default: "
michael@0 20 "create a temp directory")
michael@0 21 parser.add_argument("--tests", action='append',
michael@0 22 help="which smoketest(s) to run. by default all tests are run")
michael@0 23 parser.add_argument("build_ids", nargs="+", metavar="BUILD_ID",
michael@0 24 help="a list of build IDs to run smoketests against. the IDs will be "
michael@0 25 "sorted numerically, and partials will be generated from each to "
michael@0 26 "the last update. this list of partials will be tested along with "
michael@0 27 "a full update from each build to the last")
michael@0 28 args = parser.parse_args()
michael@0 29
michael@0 30 try:
michael@0 31 b2g = find_b2g()
michael@0 32 except EnvironmentError, e:
michael@0 33 parser.exit(1, "This tool must be run while inside the B2G directory, "
michael@0 34 "or B2G_HOME must be set in the environment.")
michael@0 35
michael@0 36 if not os.path.exists(args.build_dir):
michael@0 37 parser.exit(1, "Build dir doesn't exist: %s" % args.build_dir)
michael@0 38
michael@0 39 if len(args.build_ids) < 2:
michael@0 40 parser.exit(1, "This script requires at least two build IDs")
michael@0 41
michael@0 42 for test in args.tests:
michael@0 43 if not os.path.exists(test):
michael@0 44 parser.exit(1, "Smoketest does not exist: %s" % test)
michael@0 45
michael@0 46 try:
michael@0 47 config = SmokeTestConfig(args.build_dir)
michael@0 48 runner = SmokeTestRunner(config, b2g, run_dir=args.run_dir)
michael@0 49 runner.run_smoketests(args.build_ids, args.tests)
michael@0 50 except KeyError, e:
michael@0 51 parser.exit(1, "Error: %s" % e)
michael@0 52 except SmokeTestError, e:
michael@0 53 parser.exit(1, "Error: %s" % e)
michael@0 54
michael@0 55 if __name__ == "__main__":
michael@0 56 main()

mercurial