sbsv2/raptor/test/smoke_suite/query_cli.py
changeset 18 de5b887c98f7
child 28 b8fa7dfeeaa1
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 import raptor_tests
       
    18 
       
    19 def run():
       
    20 	
       
    21 	t = raptor_tests.SmokeTest()
       
    22 	t.description = "Test the --query command-line option"
       
    23 
       
    24 	t.name = "query_cli_alias"
       
    25 	t.command = "sbs --query=aliases"
       
    26 	t.mustmatch_singleline = [
       
    27 		"<sbs version='2\.\d+\.\d+'>",
       
    28 		"<alias.*name='armv5_urel'.*/>",
       
    29 		"<alias.*name='armv5_udeb'.*/>",
       
    30 		"<alias.*name='winscw_urel'.*/>",
       
    31 		"<alias.*name='winscw_udeb'.*/>",
       
    32 		"<alias.*name='tools2_rel'.*/>",
       
    33 		"<alias.*name='tools2_deb'.*/>",
       
    34 		"</sbs>"
       
    35 		]
       
    36 	t.mustnotmatch_singleline = [
       
    37 		"<alias.*name='make'.*/>",
       
    38 		"<alias.*name='emake'.*/>"
       
    39 		]
       
    40 	t.run()
       
    41 	
       
    42 	t.name = "query_cli_product"
       
    43 	t.command = "sbs --query=products --configpath=test/smoke_suite/test_resources/bv"
       
    44 	t.mustmatch_singleline = [
       
    45 		"<sbs version='2\.\d+\.\d+'>",
       
    46 		"<product.*name='test_bv_1'.*/>",
       
    47 		"<product.*name='test_bv_2'.*/>",
       
    48 		"<product.*name='test_bv_3'.*/>",
       
    49 		"</sbs>"
       
    50 		]
       
    51 	t.mustnotmatch_singleline = [
       
    52 		"<product.*name='arm'.*/>",
       
    53 		"<product.*name='root'.*/>"
       
    54 		]
       
    55 	t.run()
       
    56 	
       
    57 	t.name = "query_cli_config"
       
    58 	t.command = "sbs --query=config[armv5_urel]"
       
    59 	t.mustmatch_singleline = [
       
    60 		"<sbs version='2\.\d+\.\d+'>",
       
    61 		"fullname='arm\.v5\.urel\.rvct.*'",
       
    62 		"outputpath='.*/epoc32/release/armv5/urel'",
       
    63 		"</sbs>"
       
    64 		]
       
    65 	t.mustnotmatch_singleline = []
       
    66 	t.run()
       
    67 	
       
    68 	t.name = "query_cli_config_bv"
       
    69 	t.command = "sbs --query=config[armv5_urel.test_bv_1] --configpath=test/smoke_suite/test_resources/bv"
       
    70 	t.mustmatch_singleline = [
       
    71 		"<sbs version='2\.\d+\.\d+'>",
       
    72 		"fullname='arm\.v5\.urel\.rvct._.\.test_bv_1'",
       
    73 		"outputpath='.*/epoc32/release/armv5\.one/urel'",
       
    74 		"</sbs>"
       
    75 		]
       
    76 	t.mustnotmatch_singleline = []
       
    77 	t.run()
       
    78 	
       
    79 	t.name = "query_cli_config_others"
       
    80 	t.command = "sbs --query=config[winscw_urel] --query=config[tools2_rel]"
       
    81 	
       
    82 	if t.onWindows:
       
    83 		t2 = "tools2"
       
    84 	else:
       
    85 		t2 = raptor_tests.ReplaceEnvs("tools2/$(HOSTPLATFORM_DIR)")
       
    86 		
       
    87 	t.mustmatch_singleline = [
       
    88 		"<sbs version='2\.\d+\.\d+'>",
       
    89 		"outputpath='.*/epoc32/release/winscw/urel'",
       
    90 		"outputpath='.*/epoc32/release/%s/rel'" % t2,
       
    91 		"</sbs>"
       
    92 		]
       
    93 	t.mustnotmatch_singleline = []
       
    94 	t.run()
       
    95 	
       
    96 	t.name = "query_cli_bad"
       
    97 	t.command = "sbs --query=nonsense"
       
    98 	t.mustmatch_singleline = [
       
    99 		"<sbs version='2\.\d+\.\d+'>",
       
   100 		"exception 'unknown query' with query 'nonsense'",
       
   101 		"</sbs>"
       
   102 		]
       
   103 	t.mustnotmatch_singleline = []
       
   104 	t.errors = 1
       
   105 	t.returncode = 1
       
   106 	t.run()
       
   107 	
       
   108 	t.name = "query_cli"
       
   109 	t.print_result()
       
   110 	return t