1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/marionette/update-smoketests/run-smoketests.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +#!/usr/bin/env 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 argparse 1.11 +import os 1.12 +import sys 1.13 +import tempfile 1.14 + 1.15 +from smoketest import * 1.16 + 1.17 +def main(): 1.18 + parser = argparse.ArgumentParser(prog="run-smoketests.py") 1.19 + parser.add_argument("--build-dir", required=True, 1.20 + help="directory that contains builds with build ID subdirectories") 1.21 + parser.add_argument("--run-dir", default=None, 1.22 + help="directory where partials and testvars are generated. default: " 1.23 + "create a temp directory") 1.24 + parser.add_argument("--tests", action='append', 1.25 + help="which smoketest(s) to run. by default all tests are run") 1.26 + parser.add_argument("build_ids", nargs="+", metavar="BUILD_ID", 1.27 + help="a list of build IDs to run smoketests against. the IDs will be " 1.28 + "sorted numerically, and partials will be generated from each to " 1.29 + "the last update. this list of partials will be tested along with " 1.30 + "a full update from each build to the last") 1.31 + args = parser.parse_args() 1.32 + 1.33 + try: 1.34 + b2g = find_b2g() 1.35 + except EnvironmentError, e: 1.36 + parser.exit(1, "This tool must be run while inside the B2G directory, " 1.37 + "or B2G_HOME must be set in the environment.") 1.38 + 1.39 + if not os.path.exists(args.build_dir): 1.40 + parser.exit(1, "Build dir doesn't exist: %s" % args.build_dir) 1.41 + 1.42 + if len(args.build_ids) < 2: 1.43 + parser.exit(1, "This script requires at least two build IDs") 1.44 + 1.45 + for test in args.tests: 1.46 + if not os.path.exists(test): 1.47 + parser.exit(1, "Smoketest does not exist: %s" % test) 1.48 + 1.49 + try: 1.50 + config = SmokeTestConfig(args.build_dir) 1.51 + runner = SmokeTestRunner(config, b2g, run_dir=args.run_dir) 1.52 + runner.run_smoketests(args.build_ids, args.tests) 1.53 + except KeyError, e: 1.54 + parser.exit(1, "Error: %s" % e) 1.55 + except SmokeTestError, e: 1.56 + parser.exit(1, "Error: %s" % e) 1.57 + 1.58 +if __name__ == "__main__": 1.59 + main()