sbsv2/raptor/test/smoke_suite/filter_params.py
changeset 18 de5b887c98f7
equal deleted inserted replaced
14:eb060913c963 18:de5b887c98f7
       
     1 #
       
     2 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 #
       
    16 
       
    17 from raptor_tests import SmokeTest
       
    18 
       
    19 def run():
       
    20 	
       
    21 	t = SmokeTest()
       
    22 	t.description = "Test the passing of parameters to log filters"
       
    23 	
       
    24 	command = "sbs -b smoke_suite/test_resources/simple/bld.inf -c armv5_urel --filters="
       
    25 	
       
    26 	# no parameters means count all tags	
       
    27 	t.name = "filter_params_all_tags"
       
    28 	t.command = command + "FilterTagCounter"
       
    29 	t.mustmatch_singleline = [
       
    30 		"^info \d+ \d+",
       
    31 		"^whatlog \d+ \d+",
       
    32 		"^clean \d+ \d+"	
       
    33 		]
       
    34 	t.run()
       
    35 	
       
    36 	# empty parameter lists are valid
       
    37 	t.name = "filter_params_all_tags2"
       
    38 	t.command = command + "FilterTagCounter[]"
       
    39 	t.run()
       
    40 	
       
    41 	# parameters mean report only those tags	
       
    42 	t.name = "filter_params_info"
       
    43 	t.command = command + "FilterTagCounter[info]"
       
    44 	t.mustmatch_singleline = [
       
    45 		"^info \d+ \d+"
       
    46 		]
       
    47 	t.mustnotmatch_singleline = [
       
    48 		"^whatlog \d+ \d+",
       
    49 		"^clean \d+ \d+"	
       
    50 		]
       
    51 	t.run()
       
    52 	
       
    53 	# multiple parameters are valid	
       
    54 	t.name = "filter_params_info_clean"
       
    55 	t.command = command + "FilterTagCounter[info,clean]"
       
    56 	t.mustmatch_singleline = [
       
    57 		"^info \d+ \d+",
       
    58 		"^clean \d+ \d+"
       
    59 		]
       
    60 	t.mustnotmatch_singleline = [
       
    61 		"^whatlog \d+ \d+"
       
    62 		]
       
    63 	t.run()
       
    64 	
       
    65 	# using the same filter with different parameters is valid
       
    66 	t.name = "filter_params_info_clean2"
       
    67 	t.command = command + "FilterTagCounter[info],FilterTagCounter[clean]"
       
    68 	t.run()
       
    69 	
       
    70 	# using the same filter with the same parameters is valid too
       
    71 	t.name = "filter_params_info_clean3"
       
    72 	t.command = command + "FilterTagCounter[info,clean],FilterTagCounter[info,clean]"
       
    73 	t.run()
       
    74 	
       
    75 	
       
    76 	# parameters must work with the sbs_filter script as well
       
    77 	
       
    78 	command = "sbs_filter --filters=%s < smoke_suite/test_resources/logexamples/filter_component.log"
       
    79 	t.logfileOption = lambda :""
       
    80 	t.makefileOption = lambda :""
       
    81 
       
    82 	# should still work with no parameters
       
    83 	t.name = "sbs_filter_no_params"
       
    84 	t.command = command % "FilterComp"
       
    85 	t.mustmatch_singleline = [
       
    86 		]
       
    87 	t.mustnotmatch_singleline = [
       
    88 		"[<>]" # no elements should be printed at all as no bld.inf is selected
       
    89 		]
       
    90 	t.run()
       
    91 	
       
    92 	# should work with an empty parameter list
       
    93 	t.name = "sbs_filter_no_params2"
       
    94 	t.command = command % "FilterComp[]"
       
    95 	t.run()
       
    96 	
       
    97 	# with a parameter
       
    98 	t.name = "sbs_filter_one_param"
       
    99 	t.command = command % "FilterComp[email]"
       
   100 	t.stdout = [
       
   101 		"<error bldinf='y:/src/email/bld.inf'>email error #1</error>",
       
   102 		"<error bldinf='y:/src/email/bld.inf'>email error #2</error>",
       
   103 		"<warning bldinf='y:/src/email/bld.inf'>email warning #1</warning>",
       
   104 		"<warning bldinf='y:/src/email/bld.inf'>email warning #2</warning>",
       
   105 		"<whatlog bldinf='y:/src/email/bld.inf' config='armv5_urel' mmp='y:/src/email/a.mmp'>",
       
   106 		"<build>/epoc32/data/email_1</build>",
       
   107 		"<build>/epoc32/data/email_2</build>",
       
   108 		"</whatlog>",
       
   109 		"<recipe bldinf='y:/src/email/bld.inf' name='dummy'>",
       
   110 		"+ make_email",
       
   111 		"email was made fine",
       
   112 		"<status exit='ok'></status>",
       
   113 		"</recipe>",
       
   114 		"<fake bldinf='y:src/email/bld.inf'>",
       
   115 		"  <foo>",
       
   116 		"   <bar>",
       
   117 		"     <fb>fb email</fb>",
       
   118 		"   </bar>",
       
   119 		" </foo>",
       
   120 		"</fake>"
       
   121 		]
       
   122 	t.mustmatch_singleline = []
       
   123 	t.mustnotmatch_singleline = []
       
   124 	t.warnings = 2
       
   125 	t.errors = 2
       
   126 	t.run()
       
   127 	
       
   128 	# with multiple filters
       
   129 	t.name = "sbs_filter_multi"
       
   130 	t.command = command % "FilterComp[txt],FilterTagCounter[file,recipe]"
       
   131 	t.stdout = []
       
   132 	t.mustmatch_singleline = [ "txt", "^file \d+", "^recipe \d+" ]
       
   133 	t.mustnotmatch_singleline = [ "email" ]
       
   134 	t.warnings = 2
       
   135 	t.errors = 0
       
   136 	t.run()
       
   137 	
       
   138 	t.name = "filter_params"
       
   139 	t.print_result()
       
   140 	return t