|
1 #============================================================================ |
|
2 #Name : test_symbian_log.py |
|
3 #Part of : Helium |
|
4 |
|
5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
6 #All rights reserved. |
|
7 #This component and the accompanying materials are made available |
|
8 #under the terms of the License "Eclipse Public License v1.0" |
|
9 #which accompanies this distribution, and is available |
|
10 #at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
11 # |
|
12 #Initial Contributors: |
|
13 #Nokia Corporation - initial contribution. |
|
14 # |
|
15 #Contributors: |
|
16 # |
|
17 #Description: |
|
18 #=============================================================================== |
|
19 """test the Symbian log file generation""" |
|
20 |
|
21 import unittest |
|
22 import logging |
|
23 import StringIO |
|
24 import symbian.log |
|
25 |
|
26 |
|
27 # Uncomment this line to enable logging in this module, or configure logging elsewhere |
|
28 logging.basicConfig(level=logging.DEBUG) |
|
29 _logger = logging.getLogger('test.symbian.log') |
|
30 |
|
31 _test_output = """ |
|
32 ===------------------------------------------------- |
|
33 === Stage=1 |
|
34 ===------------------------------------------------- |
|
35 === Stage=1 started Fri Apr 18 21:09:55 2008 |
|
36 === Stage=1 == ncp_psw |
|
37 -- xcopy *.* \\ /F /R /Y /S |
|
38 --- Client0 Executed ID 1 |
|
39 ++ Started at Fri Apr 18 21:09:55 2008 |
|
40 +++ HiRes Start 1208542195.09307 |
|
41 Chdir \\psw\\ncp_psw\\psw |
|
42 S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\ct.ini -> S:\\s60\\tools\\customizationtool\\ct.ini |
|
43 S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPAudioEqualizer_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPAudioEqualizer_settings.xml |
|
44 S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPHWGeneral_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPHWGeneral_settings.xml |
|
45 S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPLight_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPLight_settings.xml |
|
46 S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\NCPSysAp_settings.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\NCPSysAp_settings.xml |
|
47 S:\\psw\\ncp_psw\\psw\\s60\\tools\\customizationtool\\xml_data\\VariantFeatures.xml -> S:\\s60\\tools\\customizationtool\\xml_data\\VariantFeatures.xml |
|
48 6 File(s) copied |
|
49 +++ HiRes End 1208542195.28056 |
|
50 ++ Finished at Fri Apr 18 21:09:55 2008 |
|
51 === Stage=1 finished Fri Apr 18 21:09:55 2008 |
|
52 ===------------------------------------------------- |
|
53 === Stage=2 |
|
54 ===------------------------------------------------- |
|
55 === Stage=2 started Fri Apr 18 21:29:33 2008 |
|
56 === Stage=2 == localconnectivityextensions |
|
57 -- abld export -keepgoing |
|
58 --- Client2 Executed ID 213 |
|
59 ++ Started at Fri Apr 18 21:29:33 2008 |
|
60 +++ HiRes Start 1208543373.36786 |
|
61 Chdir \s60\osext\localconnectivityextensions\group |
|
62 make -r -k -f "\EPOC32\BUILD\s60\osext\localconnectivityextensions\group\EXPORT.make" EXPORT VERBOSE=-s KEEPGOING=-k |
|
63 copy "\s60\osext\localconnectivityextensions\lcext_dom\bluetooth_audio_adaptation_api\inc\btaudiostreaminputbase.h" "\epoc32\include\domain\osextensions\btaudiostreaminputbase.h" |
|
64 1 file(s) copied. |
|
65 copy "\s60\osext\localconnectivityextensions\lcext_dom\bluetooth_power_management_api\inc\btpm.h" "\epoc32\include\domain\osextensions\btpm.h" |
|
66 1 file(s) copied. |
|
67 +++ HiRes End 1208543373.72723 |
|
68 ++ Finished at Fri Apr 18 21:29:33 2008 |
|
69 === Stage=2 == messagingextensions |
|
70 -- abld export -keepgoing |
|
71 --- Client6 Executed ID 217 |
|
72 ++ Started at Fri Apr 18 21:29:33 2008 |
|
73 +++ HiRes Start 1208543373.36786 |
|
74 Chdir \s60\osext\messagingextensions\group |
|
75 make -r -k -f "\EPOC32\BUILD\s60\osext\messagingextensions\group\EXPORT.make" EXPORT VERBOSE=-s KEEPGOING=-k |
|
76 Creating \epoc32\include\domain\osextensions\loc\sc |
|
77 Creating \epoc32\rom\include\language\osext |
|
78 copy "\s60\osext\messagingextensions\msgbranched\rom\messageserver_rsc.iby" "\epoc32\rom\include\language\osext\messageserver_rsc.iby" |
|
79 1 file(s) copied. |
|
80 copy "\s60\osext\messagingextensions\msgbranched\rom\gtemailmtmResources.iby" "\epoc32\rom\include\language\osext\gtemailmtmResources.iby" |
|
81 1 file(s) copied. |
|
82 copy "\s60\osext\messagingextensions\msgbranched\messaging\email\clientmtms\loc\imcm.loc" "\epoc32\include\domain\osextensions\loc\sc\imcm.loc" |
|
83 1 file(s) copied. |
|
84 copy "\s60\osext\messagingextensions\msgbranched\messaging\email\clientmtms\loc\imcm_default_charset.loc" "\epoc32\include\domain\osextensions\loc\sc\imcm_default_charset.loc" |
|
85 1 file(s) copied. |
|
86 copy "\s60\osext\messagingextensions\msgbranched\messaging\framework\server\loc\msgs.loc" "\epoc32\include\domain\osextensions\loc\sc\msgs.loc" |
|
87 1 file(s) copied. |
|
88 +++ HiRes End 1208543373.80535 |
|
89 ++ Finished at Fri Apr 18 21:29:33 2008 |
|
90 === Stage=2 finished Fri Apr 18 21:09:55 2008 |
|
91 """ |
|
92 |
|
93 |
|
94 |
|
95 class Parser(symbian.log.Parser): |
|
96 """ A Symbian log parser for testing purpose """ |
|
97 def __init__(self, content=StringIO.StringIO(_test_output)): |
|
98 symbian.log.Parser.__init__(self, content) |
|
99 self.stages = [] |
|
100 self.tasks = [] |
|
101 |
|
102 def start_stage(self, name, _): |
|
103 """start_stage""" |
|
104 _logger.debug(name) |
|
105 self.stages.append(name) |
|
106 |
|
107 def task(self, name, cmdline, dir, output): |
|
108 """task""" |
|
109 _logger.debug("%s, %s, %s, %s" % (name, cmdline, dir, output)) |
|
110 self.tasks.append({'name': name, 'cmdline': cmdline, 'dir': dir, 'output': output}) |
|
111 |
|
112 |
|
113 class TestSymbianLog(unittest.TestCase): |
|
114 """ Test cases for Helium Symbian log parser. """ |
|
115 |
|
116 def test_parser(self): |
|
117 """ Test the parser |
|
118 """ |
|
119 parser = Parser() |
|
120 parser.parse() |
|
121 assert len(parser.stages) == 2 |
|
122 assert len(parser.tasks) == 3 |