buildframework/helium/sf/python/pythoncore/lib/pythoncorecpythontests/test_atsant.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:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
#============================================================================ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
#Name        : test_atsant.py 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
#Part of     : Helium 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
#All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
#This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
#under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
#which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
#Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
#Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
#Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
#Description:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
#===============================================================================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
""" atsant.py module tests. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
import os
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
import logging
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
import tempfile
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
import shutil
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
_logger = logging.getLogger('test.atsant')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
import atsant
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    30
def test_atsant_multipledrop():
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
    """test atsant and check 3 files in the file"""
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    32
    files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/layers.sysdef.xml'), None, None, 'z:', 'false')
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
    assert len(files) == 3
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    34
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    35
def test_atsant_singledrop():
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    36
    """test atsant and check 1 files in the file"""
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    37
    files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/layers.sysdef.xml'), None, None, 'z:', 'true')
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    38
    assert len(files) == 1
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    39
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    40
def test_atsant_multipledrop_with_sysdef3():
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    41
    """test atsant and check MULTIPLE drop files are created when sysdef3 files are in use"""
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    42
    files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/sysdef3_test.xml'), None, None, 'z:', 'false', True)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    43
    assert len(files) == 2
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    44
    
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    45
def test_atsant_singledrop_with_sysdef3():
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    46
    """test atsant and check SINGLE drop file is created when sysdef3 files are in use"""
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    47
    files = atsant.files_to_test(os.path.join(os.environ['TEST_DATA'], 'data/packageiad/sysdef3_test.xml'), None, None, 'z:', 'true', True)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    48
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    49
    assert len(files) == 1
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    50
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
def test_IConfigATS():
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    52
    """test I config ATS"""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
    tmpdir = tempfile.mkdtemp()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
    shutil.copy(os.path.join(os.environ['TEST_DATA'], 'data', 'example_corernd.iconfig.xml'), os.path.join(tmpdir, 'example_corernd.iconfig.xml'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
    open(os.path.join(tmpdir, 'RX-60_00_rnd.core.fpsx'), 'w').close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
    open(os.path.join(tmpdir, 'RX-60_00.01_rnd.rofs2.fpsx'), 'w').close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
    open(os.path.join(tmpdir, 'RX-60_00_rnd.rofs3.fpsx'), 'w').close()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
    open(os.path.join(tmpdir, 'RX-60_00_rnd.udaerase.fpsx'), 'w').close()
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    59
    i_c = atsant.IConfigATS(tmpdir, '')
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    60
    i_c.findimages()