buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_build_io.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_build_io.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
""" Test the build.io module. """
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    21
# pylint: disable=R0201
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    22
#method could be a function warning removed
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
import logging
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
import unittest
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
import os
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
import build.io
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    30
_logger = logging.getLogger('test.build.io')
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
class AbldLogWhatReaderTest(unittest.TestCase):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
    """ Test reading Symbian build logs for extracting abld -what sections. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
    def test_abld_what_parsing(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
        """ Basic abld -what section parsing. """ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
        reader = build.io.AbldLogWhatReader(os.path.join(os.environ['TEST_DATA'], 'data/build/io/abld_what.log'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
        reader_iter = iter(reader)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
        (component1, binaries1) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
        assert component1 == 'ibusal_chipset_product'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
        assert binaries1 == [r'\epoc32\release\ARMV5\UDEB\_product_NaviScrollPdd.pdd',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
                             r'\epoc32\release\ARMV5\UDEB\_product_NaviScrollPdd.pdd.map']
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
        (component2, binaries2) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
        assert component2 == 'ibusal_chipset_product2'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
        assert binaries2 == [r'\epoc32\release\ARMV5\UDEB\_product2_accelerometerpdd.pdd',
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
                             r'\epoc32\release\ARMV5\UDEB\_product2_accelerometerpdd.pdd.map']
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
class RombuildLogBinarySizeReaderTest(unittest.TestCase):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
    """ Test reading Symbian ROM build logs for extracting binaries and their sizes. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
    def test_rom_log_parsing(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
        """ Basic ROM log binary size parsing. """ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
        reader = build.io.RombuildLogBinarySizeReader(os.path.join(os.environ['TEST_DATA'], 'data/build/io/test_rom.log'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
        reader_iter = iter(reader)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
        (binary, size, rom_type) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
        assert binary == r'\epoc32\release\ARMV5\urel\__ekern.exe'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
        assert size == 221788
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
        assert rom_type == 'rom'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
        (binary, size, rom_type) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
        assert binary == r'\epoc32\release\ARMV5\urel\elocd.ldd'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
        assert size == 15192
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
        assert rom_type == 'rom'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
        (binary, size, rom_type) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
        assert binary == r'\epoc32\release\ARMV5\urel\__medint.pdd'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
        assert size == 2320
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
        assert rom_type == 'rom'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
    def test_rofs_log_parsing(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
        """ Basic ROFS log binary size parsing. """ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
        reader = build.io.RombuildLogBinarySizeReader(os.path.join(os.environ['TEST_DATA'], 'data/build/io/test_rofs.log'))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
        reader_iter = iter(reader)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
        (binary, size, rom_type) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
        assert binary == r'\epoc32\data\Z\Resource\ICL\jpegcodec_extra.rsc'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
        assert size == 202
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
        assert rom_type == 'rofs'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
        (binary, size, rom_type) = reader_iter.next()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
        assert binary == r'\epoc32\release\ARMV5\urel\jpegcodec.dll'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
        assert size == 89728
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
        assert rom_type == 'rofs'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85