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