buildframework/helium/tools/common/python/lib/cpythontest/test_matti.py
author wbernard
Wed, 23 Dec 2009 19:29:07 +0200
changeset 179 d8ac696cc51f
permissions -rw-r--r--
helium_7.0-r14027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     1
# -*- coding: latin-1 -*-
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     2
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     3
#============================================================================ 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     4
#Name        : test_matti.py 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     5
#Part of     : Helium 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     6
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     7
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     8
#All rights reserved.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
     9
#This component and the accompanying materials are made available
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    10
#under the terms of the License "Eclipse Public License v1.0"
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    11
#which accompanies this distribution, and is available
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    12
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    13
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    14
#Initial Contributors:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    15
#Nokia Corporation - initial contribution.
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    16
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    17
#Contributors:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    18
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    19
#Description:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    20
#===============================================================================
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    21
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    22
""" Testing MATTI framework. """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    23
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    24
# pylint: disable-msg=E1101,W0603,W0142
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    25
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    26
import logging
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    27
logging.getLogger().setLevel(logging.ERROR)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    28
import os
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    29
#import shutil
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    30
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    31
from path import path
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    32
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    33
import ats3.aste
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    34
import ats3.matti.MattiDrops
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    35
#from lxml import objectify
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    36
#from lxml import etree
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    37
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    38
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    39
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    40
# Shortcuts
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    41
HELIUM_ADDR = os.environ['HELIUM_HOME']
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    42
TEST_FILE_NAME = os.path.join(HELIUM_ADDR, 'test.xml')
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    43
ZIP_FILE_NAME = os.path.join(HELIUM_ADDR, 'MATTIDrop.zip')
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    44
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    45
class Bunch(object):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    46
    """do something with the paramerters passed to it"""    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    47
    def __init__(self, **kwargs): 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    48
        self.__dict__.update(kwargs)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    49
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    50
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    51
def equal_xml(result, expect):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    52
    """Check the equality of the given XML snippets. """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    53
#    logging.info(" expect %s" % expect)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    54
#    xml1 = objectify.fromstring(expect)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    55
#    expect1 = etree.tostring(xml1)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    56
#    logging.info(" expect1 %s" % expect1)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    57
#    logging.info(" expect2 -------------%s" % expect2)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    58
#            
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    59
#    xml2 = objectify.fromstring(result)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    60
#    result2 = etree.tostring(xml2)        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    61
#    self.assertEquals(expect1, result1)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    62
#
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    63
#    if xml1.tag != xml2.tag:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    64
#        return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    65
#    if xml1.attrib != xml2.attrib:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    66
#        return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    67
#    if xml1.text:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    68
#        if not xml2.text:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    69
#            return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    70
#    if xml2.text:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    71
#        if not xml1.text:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    72
#            return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    73
#    if xml1.text and xml2.text and xml1.text.strip() != xml2.text.strip():
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    74
#        return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    75
#    if xml1.tail is not None and xml2.tail is not None:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    76
#        if xml1.tail.strip() != xml2.tail.strip():
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    77
#            return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    78
#    elif xml1.tail != xml2.tail:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    79
#        return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    80
#    children1 = list(xml1.getchildren())
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    81
#    children2 = list(xml2.getchildren())
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    82
#    if len(children1) != len(children2):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    83
#        return False
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    84
#    for child1, child2 in zip(children1, children2):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    85
#        return equal_xml(child1, child2)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    86
#    return True
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    87
    if expect:
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    88
        return result   
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    89
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    90
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    91
def setup_module():
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    92
    """ stuff to do before running the tests """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    93
    pass    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    94
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    95
def teardown_module():
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    96
    """ stuff to do after running the tests """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    97
    if os.path.exists(TEST_FILE_NAME):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    98
        os.remove(TEST_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
    99
    if os.path.exists(ZIP_FILE_NAME):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   100
        os.remove(ZIP_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   101
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   102
    
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   103
class TestPlanMatti():
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   104
    """ test MattiDrop.py """
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   105
    def __init__(self): 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   106
        self.config = None
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   107
        self.tp_result = None
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   108
            
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   109
    def test_all_present(self):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   110
        """ test mattiDrops.py with all parameters present and correct"""
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   111
        teardown_module()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   112
        opts = Bunch(build_drive="z:", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   113
             matti_scripts=os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/script/'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   114
             flash_images = HELIUM_ADDR + os.sep + "testconfig/ats3/matti/variant_images/test_file.fpsx," \
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   115
                + HELIUM_ADDR + os.sep + "testconfig/ats3/matti/variant_images/test_file_3rd.fpsx," \
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   116
                + HELIUM_ADDR + os.sep + "testconfig/ats3/matti/variant_images/test_file_another.fpsx",
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   117
             report_email="", harness="STIF", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   118
             file_store=path(), testrun_name="testrun",  
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   119
             device_type="product", device_hwid="5425", diamonds_build_url="", drop_file="MATTIDrop.zip", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   120
             minimum_flash_images="2", plan_name="matti_test_plan", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   121
             sis_files= HELIUM_ADDR + os.sep + "testconfig/ats3/matti/sis/test_file_matti_install.sis," \
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   122
                + HELIUM_ADDR + os.sep + "testconfig/ats3/matti/sis/another_test_file_matti_install.sis", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   123
             template_loc=os.path.join(HELIUM_ADDR, 'tools/common/python/lib/ats3/matti/template/matti_demo.xml'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   124
             test_timeout="60", verbose="false")
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   125
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   126
        self.config = ats3.matti.MattiDrops.Configuration(opts)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   127
        self.tp_result = ats3.matti.MattiDrops.create_drop(self.config)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   128
        assert os.path.exists(ZIP_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   129
        assert os.path.exists(TEST_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   130
        #shutil.copy(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_all_present.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   131
        #equal_xml(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_all_present.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   132
        
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   133
    def test_no_sis_or_flash_files(self):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   134
        """test mattiDrops.py with no sis or flash files in the parameters"""
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   135
        teardown_module()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   136
        opts = Bunch(build_drive="z:", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   137
             matti_scripts=os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/script/'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   138
             flash_images = "",
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   139
             report_email="", harness="STIF", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   140
             file_store=path(), testrun_name="testrun",  
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   141
             device_type="product", device_hwid="5425", diamonds_build_url="", drop_file="MATTIDrop.zip", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   142
             minimum_flash_images="2", plan_name="matti_test_plan", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   143
             sis_files= "", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   144
             template_loc=os.path.join(HELIUM_ADDR, 'tools/common/python/lib/ats3/matti/template/matti_demo.xml'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   145
             test_timeout="60", verbose="true")
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   146
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   147
        self.config = ats3.matti.MattiDrops.Configuration(opts)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   148
        self.tp_result = ats3.matti.MattiDrops.create_drop(self.config)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   149
        assert os.path.exists(ZIP_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   150
        assert os.path.exists(TEST_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   151
        #shutil.copy(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_no_sis_or_flash.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   152
        #equal_xml(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_no_sis_or_flash.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   153
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   154
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   155
    def test_no_files(self):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   156
        """ test mattiDtops.py with no filespresent at all"""
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   157
        teardown_module()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   158
        opts = Bunch(build_drive="z:", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   159
             matti_scripts=os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/variant_images/'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   160
             flash_images = "",
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   161
             report_email="", harness="STIF", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   162
             file_store=path(), testrun_name="testrun",  
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   163
             device_type="product", device_hwid="5425", diamonds_build_url="", drop_file="MATTIDrop.zip", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   164
             minimum_flash_images="2", plan_name="matti_test_plan", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   165
             sis_files= "", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   166
             template_loc=os.path.join(HELIUM_ADDR, 'tools/common/python/lib/ats3/matti/template/matti_demo.xml'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   167
             test_timeout="60", verbose="true")
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   168
        self.config = ats3.matti.MattiDrops.Configuration(opts)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   169
        self.tp_result = ats3.matti.MattiDrops.create_drop(self.config)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   170
        assert not os.path.exists(ZIP_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   171
        assert os.path.exists(TEST_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   172
        #shutil.copy(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_no_files.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   173
        #equal_xml(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_no_files.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   174
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   175
    def test_no_params(self):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   176
        """test MattiDrops.py with no parameters present at all"""
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   177
        teardown_module()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   178
        opts = Bunch(build_drive="", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   179
             matti_scripts="", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   180
             flash_images = "",
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   181
             report_email="", harness="", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   182
             file_store="", testrun_name="",  
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   183
             device_type="", device_hwid="", diamonds_build_url="", drop_file="", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   184
             minimum_flash_images="", plan_name="", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   185
             sis_files= "", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   186
             template_loc="", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   187
             test_timeout="", verbose="true")
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   188
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   189
        self.config = ats3.matti.MattiDrops.Configuration(opts)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   190
        self.tp_result = ats3.matti.MattiDrops.create_drop(self.config)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   191
        assert not os.path.exists(ZIP_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   192
        assert not os.path.exists(TEST_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   193
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   194
    def test_some_not_present(self):
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   195
        """ test MattiDrops.py with an extra file not present in the dir"""
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   196
        teardown_module()
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   197
        opts = Bunch(build_drive="z:", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   198
             matti_scripts=os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/script/'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   199
             flash_images = HELIUM_ADDR + os.sep + "testconfig/ats3/matti/variant_images/test_file.fpsx," \
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   200
                + HELIUM_ADDR + os.sep + "testconfig/ats3/matti/variant_images/test_file_3rd.fpsx," \
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   201
                + HELIUM_ADDR + os.sep + "testconfig/ats3/matti/variant_images/test_file_different.fpsx",
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   202
             report_email="", harness="STIF", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   203
             file_store=path(), testrun_name="testrun",  
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   204
             device_type="product", device_hwid="5425", diamonds_build_url="", drop_file="MATTIDrop.zip", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   205
             minimum_flash_images="2", plan_name="matti_test_plan", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   206
             sis_files= HELIUM_ADDR + os.sep + "testconfig/ats3/matti/sis/test_file_matti_install.sis," \
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   207
                + HELIUM_ADDR + os.sep + "testconfig/ats3/matti/sis/another_test_file.sis", 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   208
             template_loc=os.path.join(HELIUM_ADDR, 'tools/common/python/lib/ats3/matti/template/matti_demo.xml'), 
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   209
             test_timeout="60", verbose="false")
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   210
       
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   211
        self.config = ats3.matti.MattiDrops.Configuration(opts)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   212
        self.tp_result = ats3.matti.MattiDrops.create_drop(self.config)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   213
        assert os.path.exists(ZIP_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   214
        assert os.path.exists(TEST_FILE_NAME)
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   215
        #shutil.copy(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_some_not_present.xml'))
d8ac696cc51f helium_7.0-r14027
wbernard
parents:
diff changeset
   216
        #equal_xml(TEST_FILE_NAME, os.path.join(HELIUM_ADDR, 'testconfig/ats3/matti/test_some_not_present.xml'))