phonesrv_plat/call_information_api/tsrc/run_auto_tests.bat
changeset 0 ff3b6d0fd310
child 3 a4a774cb6ea7
child 15 d7fc66ccd6fb
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 rem
       
     2 rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 rem All rights reserved.
       
     4 rem This component and the accompanying materials are made available
       
     5 rem under the terms of "Eclipse Public License v1.0"
       
     6 rem which accompanies this distribution, and is available
       
     7 rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 rem
       
     9 rem Initial Contributors:
       
    10 rem Nokia Corporation - initial contribution.
       
    11 rem
       
    12 rem Contributors:
       
    13 rem
       
    14 rem Description:
       
    15 rem
       
    16 
       
    17 @echo off
       
    18 setlocal
       
    19 goto :startup 
       
    20 
       
    21 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    22 :: function DEFAULT
       
    23 ::
       
    24 :: Modify this function
       
    25 ::  - TESTED_SRC can be changed to match tested code.
       
    26 ::    Specifies path from testcode group directory to
       
    27 ::    tested code
       
    28 ::  - Add test directories to be runned
       
    29 ::    ie. "call :build ut_projectdirectory" or use
       
    30 ::    "for /f %%a in ('dir /b ut_*') do call :build %%a"
       
    31 ::    which compiles, instruments and runs all test directories
       
    32 ::    starting with "ut_".
       
    33 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    34 :DEFAULT
       
    35 set TESTED_SRC=
       
    36 
       
    37 if [%DOMODULESTESTS%] EQU [TRUE] (
       
    38 call :build .
       
    39 )
       
    40 
       
    41 call :finish
       
    42 goto :END
       
    43 
       
    44 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    45 :: function STARTUP
       
    46 ::
       
    47 :: Initializing script
       
    48 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    49 :STARTUP
       
    50 
       
    51 set BUILDTESTS=TRUE
       
    52 set RUNTESTS=TRUE
       
    53 set REMOVETESTS=TRUE
       
    54 set INSTRUMENT=TRUE
       
    55 set REMOVEINSTRUMENT=TRUE
       
    56 set DOMODULESTESTS=TRUE
       
    57 set ABLD_CALL=abld test build winscw udeb -keepgoing
       
    58 set PATH_TO_DLL=\epoc32\release\winscw\udeb
       
    59 set PATH_TO_MOVE_DLL=\epoc32\release\winscw\udeb\z\sys\bin
       
    60 set PATH_TO_COVERAGE_DATA=\coverage_data
       
    61 
       
    62 
       
    63 if not exist %PATH_TO_DLL%\eunitexerunner.exe  ( 
       
    64 echo EUnit not installed! 
       
    65 goto end
       
    66 )
       
    67 
       
    68 if not exist %PATH_TO_COVERAGE_DATA% (
       
    69 mkdir %PATH_TO_COVERAGE_DATA%
       
    70 )
       
    71 
       
    72 if [%1] EQU [] ( goto default )
       
    73 
       
    74 call :%1
       
    75 call :%2
       
    76 call :%3
       
    77 call :%4
       
    78 call :%5
       
    79 echo Running tests = %RUNTESTS%
       
    80 echo Instrumenting tests = %INSTRUMENT%
       
    81 goto default
       
    82 
       
    83 :/NOCLEANUP
       
    84 set REMOVEINSTRUMENT=FALSE
       
    85 set REMOVETESTS=FALSE
       
    86 goto end
       
    87 
       
    88 :/NORUN
       
    89 set RUNTESTS=FALSE
       
    90 set REMOVEINSTRUMENT=FALSE
       
    91 set REMOVETESTS=FALSE
       
    92 goto end
       
    93 
       
    94 :/NOINSTRUMENT
       
    95 set INSTRUMENT=FALSE
       
    96 goto end
       
    97 
       
    98 :/NOBUILD
       
    99 set BUILDTESTS=FALSE
       
   100 goto end
       
   101 
       
   102 :/ONLYUNITTESTS
       
   103 set DOMODULESTESTS=FALSE
       
   104 goto end
       
   105 
       
   106 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   107 :: function FINISH
       
   108 ::
       
   109 :: Finishes run_auto_tests.bat
       
   110 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   111 :FINISH
       
   112 call :move
       
   113 
       
   114 if [%RUNTESTS%] EQU [TRUE] (
       
   115 call :runtests
       
   116 )
       
   117 
       
   118 if [%REMOVETESTS%] EQU [TRUE] (
       
   119 call :removetests
       
   120 )
       
   121 
       
   122 if [%INSTRUMENT%] EQU [TRUE] (
       
   123 call :calculatecoverage
       
   124 )
       
   125 
       
   126 if [%REMOVEINSTRUMENT%] EQU [TRUE] (
       
   127 call :removecoverage
       
   128 )
       
   129 goto end
       
   130 
       
   131 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   132 :: function BUILD
       
   133 ::    param directory
       
   134 ::
       
   135 :: builds test from given directory
       
   136 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   137 :BUILD
       
   138 setlocal
       
   139 if [%BUILDTESTS%] EQU [FALSE] ( goto end )
       
   140 echo Building %1
       
   141 if not exist %1 ( 
       
   142 echo %1 Not found! 
       
   143 goto end
       
   144 )
       
   145 
       
   146 pushd .
       
   147 call cd %1\group
       
   148 call bldmake bldfiles
       
   149 call abld test clean winscw udeb
       
   150 if [%INSTRUMENT%] EQU [TRUE] (
       
   151 call ctcwrap -n %PATH_TO_COVERAGE_DATA%\%1 -i d -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" %ABLD_CALL%
       
   152 ) else (
       
   153 call %ABLD_CALL%
       
   154 )
       
   155 
       
   156 popd
       
   157 endlocal
       
   158 goto end
       
   159 
       
   160 
       
   161 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   162 :: function MOVE
       
   163 ::
       
   164 :: moves compiled tests to eunit directory
       
   165 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   166 :MOVE
       
   167 echo Moving tests
       
   168 call move %PATH_TO_DLL%\ut_*.dll %PATH_TO_MOVE_DLL%
       
   169 call move %PATH_TO_DLL%\mt_*.dll %PATH_TO_MOVE_DLL%
       
   170 goto end
       
   171 
       
   172 
       
   173 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   174 :: function RUNTESTS
       
   175 ::
       
   176 :: Runs tests in eunit directory
       
   177 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   178 :RUNTESTS
       
   179 echo Running tests
       
   180 call %PATH_TO_DLL%\eunitexerunner.exe -dtextshell --
       
   181 copy \epoc32\winscw\c\shared\EUnit\Logs\EUnit_log.xml \lastrun_EUnit_log.xml
       
   182 goto end
       
   183 
       
   184 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   185 :: function CALCULATECOVERAGE
       
   186 ::
       
   187 :: Calculates test coverage. Generates html
       
   188 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   189 :CALCULATECOVERAGE
       
   190 echo Calculating coverage
       
   191 ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt
       
   192 call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb
       
   193 goto end
       
   194 
       
   195 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   196 :: function REMOVETESTS
       
   197 ::
       
   198 :: Removes tests from eunit directory
       
   199 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   200 :REMOVETESTS
       
   201 echo Removing Test dlls
       
   202 call sleep 3
       
   203 call del %PATH_TO_MOVE_DLL%\t_*.dll
       
   204 call del %PATH_TO_MOVE_DLL%\mt_*.dll
       
   205 call del %PATH_TO_MOVE_DLL%\ut_*.dll
       
   206 call del %PATH_TO_MOVE_DLL%\it_*.dll
       
   207 goto end
       
   208 
       
   209 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   210 :: function REMOVECOVERAGE
       
   211 ::
       
   212 :: Removes data from coverage directory
       
   213 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   214 :REMOVECOVERAGE
       
   215 echo Removing deleting coverage data
       
   216 call del %PATH_TO_COVERAGE_DATA%\*.sym
       
   217 call del %PATH_TO_COVERAGE_DATA%\*.dat
       
   218 call del profile.txt
       
   219 goto end
       
   220 
       
   221 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   222 :: function END
       
   223 ::
       
   224 :: Prints done
       
   225 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   226 :END
       
   227 echo Done!