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