|
1 #============================================================================ |
|
2 #Name : custom.py |
|
3 #Part of : Helium |
|
4 |
|
5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
6 #All rights reserved. |
|
7 #This component and the accompanying materials are made available |
|
8 #under the terms of the License "Eclipse Public License v1.0" |
|
9 #which accompanies this distribution, and is available |
|
10 #at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
11 # |
|
12 #Initial Contributors: |
|
13 #Nokia Corporation - initial contribution. |
|
14 # |
|
15 #Contributors: |
|
16 # |
|
17 #Description: |
|
18 #=============================================================================== |
|
19 |
|
20 import ats3 |
|
21 import ats3.dropgenerator as adg |
|
22 from optparse import OptionParser |
|
23 from path import path # pylint: disable-msg=F0401 |
|
24 import logging |
|
25 _logger = logging.getLogger('ats') |
|
26 |
|
27 def create_drop(config): |
|
28 """Create a test drop.""" |
|
29 test_plan = ats3.Ats3TestPlan(config) |
|
30 test_plan.set_plan_harness() |
|
31 flash_images = [path(p) for p in config.flash_images] |
|
32 test_plan.insert_set(image_files=flash_images) |
|
33 generator = adg.Ats3TemplateTestDropGenerator() |
|
34 _logger.info("generating drop file: %s" % config.drop_file) |
|
35 generator.generate(test_plan, output_file=config.drop_file, config_file=config.config_file) |
|
36 |
|
37 def main(): |
|
38 cli = OptionParser(usage="%prog [options]") |
|
39 cli.add_option("--device-type", help="Device type (e.g. 'PRODUCT')", default="unknown") |
|
40 cli.add_option("--diamonds-build-url", help="Diamonds build url", default='') |
|
41 cli.add_option("--drop-file", help="Name for the final drop zip file", default="ATS3Drop.zip") |
|
42 cli.add_option("--file-store", help="Destination path for reports.", default="") |
|
43 cli.add_option("--flash-images", help="Paths to the flash image files", default="") |
|
44 cli.add_option("--report-email", help="Email notification receivers", default="") |
|
45 cli.add_option("--testrun-name", help="Name of the test run", default="run") |
|
46 cli.add_option("--config", help="Path to the config file", default="") |
|
47 cli.add_option("--test-timeout", help="Test execution timeout value (default: %default)", default="60") |
|
48 cli.add_option("--custom-template", help="Path to the ats template file") |
|
49 cli.add_option("--ats4-enabled", help="ATS4 enabled", default="True") |
|
50 cli.add_option("--verbose", help="Increase output verbosity", action="store_true", default=True) |
|
51 cli.add_option("--test-type", help="Name of test harness") |
|
52 opts, _ = cli.parse_args() |
|
53 |
|
54 if opts.verbose: |
|
55 _logger.setLevel(logging.DEBUG) |
|
56 logging.basicConfig(level=logging.DEBUG) |
|
57 |
|
58 config = ats3.Configuration(opts, []) |
|
59 create_drop(config) |
|
60 |
|
61 if __name__ == "__main__": |
|
62 main() |