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