buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_symbian_log.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
#============================================================================ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
#Name        : test_symbian_log.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
"""test the Symbian log file generation"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
import unittest
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
import logging
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
import StringIO
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
import symbian.log
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
# Uncomment this line to enable logging in this module, or configure logging elsewhere
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    28
logging.basicConfig(level=logging.DEBUG)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
_logger = logging.getLogger('test.symbian.log')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
_test_output = """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
===-------------------------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
=== Stage=1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
===-------------------------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
=== Stage=1 started Fri Apr 18 21:09:55 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
=== Stage=1 == ncp_psw
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
-- xcopy *.*  \\ /F /R /Y /S
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
--- Client0 Executed ID 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
++ Started at Fri Apr 18 21:09:55 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
+++ HiRes Start 1208542195.09307
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
Chdir \\psw\\ncp_psw\\psw
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\ct.ini -> S:\\s60\\tools\\customizationtool\\ct.ini
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPAudioEqualizer_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPAudioEqualizer_settings.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPHWGeneral_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPHWGeneral_settings.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPLight_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPLight_settings.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPSysAp_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPSysAp_settings.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\VariantFeatures.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\VariantFeatures.xml
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
6 File(s) copied
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
+++ HiRes End 1208542195.28056
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
++ Finished at Fri Apr 18 21:09:55 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
=== Stage=1 finished Fri Apr 18 21:09:55 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
===-------------------------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
=== Stage=2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
===-------------------------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
=== Stage=2 started Fri Apr 18 21:29:33 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
=== Stage=2 == localconnectivityextensions
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
-- abld export -keepgoing
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
--- Client2 Executed ID 213
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
++ Started at Fri Apr 18 21:29:33 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
+++ HiRes Start 1208543373.36786
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
Chdir \s60\osext\localconnectivityextensions\group
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
  make -r  -k -f "\EPOC32\BUILD\s60\osext\localconnectivityextensions\group\EXPORT.make" EXPORT VERBOSE=-s KEEPGOING=-k
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
copy "\s60\osext\localconnectivityextensions\lcext_dom\bluetooth_audio_adaptation_api\inc\btaudiostreaminputbase.h" "\epoc32\include\domain\osextensions\btaudiostreaminputbase.h"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
copy "\s60\osext\localconnectivityextensions\lcext_dom\bluetooth_power_management_api\inc\btpm.h" "\epoc32\include\domain\osextensions\btpm.h"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
+++ HiRes End 1208543373.72723
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
++ Finished at Fri Apr 18 21:29:33 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
=== Stage=2 == messagingextensions
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
-- abld export -keepgoing
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
--- Client6 Executed ID 217
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
++ Started at Fri Apr 18 21:29:33 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
+++ HiRes Start 1208543373.36786
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
Chdir \s60\osext\messagingextensions\group
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
  make -r  -k -f "\EPOC32\BUILD\s60\osext\messagingextensions\group\EXPORT.make" EXPORT VERBOSE=-s KEEPGOING=-k
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
Creating \epoc32\include\domain\osextensions\loc\sc
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
Creating \epoc32\rom\include\language\osext
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
copy "\s60\osext\messagingextensions\msgbranched\rom\messageserver_rsc.iby" "\epoc32\rom\include\language\osext\messageserver_rsc.iby"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
copy "\s60\osext\messagingextensions\msgbranched\rom\gtemailmtmResources.iby" "\epoc32\rom\include\language\osext\gtemailmtmResources.iby"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
copy "\s60\osext\messagingextensions\msgbranched\messaging\email\clientmtms\loc\imcm.loc" "\epoc32\include\domain\osextensions\loc\sc\imcm.loc"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
copy "\s60\osext\messagingextensions\msgbranched\messaging\email\clientmtms\loc\imcm_default_charset.loc" "\epoc32\include\domain\osextensions\loc\sc\imcm_default_charset.loc"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
copy "\s60\osext\messagingextensions\msgbranched\messaging\framework\server\loc\msgs.loc" "\epoc32\include\domain\osextensions\loc\sc\msgs.loc"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
        1 file(s) copied.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
+++ HiRes End 1208543373.80535
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
++ Finished at Fri Apr 18 21:29:33 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
=== Stage=2 finished Fri Apr 18 21:09:55 2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
class Parser(symbian.log.Parser):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
    """ A Symbian log parser for testing purpose """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
    def __init__(self, content=StringIO.StringIO(_test_output)):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
        symbian.log.Parser.__init__(self, content)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
        self.stages = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
        self.tasks = []
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
    def start_stage(self, name, _):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
        """start_stage"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
        _logger.debug(name) 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
        self.stages.append(name)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   107
    def task(self, name, cmdline, dir_, output):
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
        """task"""
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   109
        _logger.debug("%s, %s, %s, %s" % (name, cmdline, dir_, output)) 
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   110
        self.tasks.append({'name': name, 'cmdline': cmdline, 'dir': dir_, 'output': output})
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
class TestSymbianLog(unittest.TestCase):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
    """ Test cases for Helium Symbian log parser. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
    def test_parser(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
        """ Test the parser
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
        """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
        parser = Parser()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
        parser.parse()
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
        assert len(parser.stages) == 2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
        assert len(parser.tasks) == 3