phoneapp/phoneringingtoneplayer/tsrc/run_auto_tests.bat
changeset 78 baacf668fe89
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
       
     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 the License "Symbian Foundation License v1.0"
       
     6 rem which accompanies this distribution, and is available
       
     7 rem at the URL "http://www.symbianfoundation.org/legal/sfl-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=..\..\..\src\*
       
    36 
       
    37 for /f %%a in ('dir /b ut_*') do call :build %%a
       
    38 
       
    39 if [%DOMODULESTESTS%] EQU [TRUE] (
       
    40 for /f %%a in ('dir /b mt_*') do call :build %%a
       
    41 )
       
    42 
       
    43 
       
    44 call :finish
       
    45 goto :END
       
    46 
       
    47 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    48 :: function STARTUP
       
    49 ::
       
    50 :: Initializing script
       
    51 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    52 :STARTUP
       
    53 
       
    54 set BUILDTESTS=TRUE
       
    55 set RUNTESTS=TRUE
       
    56 set REMOVETESTS=TRUE
       
    57 set INSTRUMENT=TRUE
       
    58 set REMOVEINSTRUMENT=TRUE
       
    59 set DOMODULESTESTS=TRUE
       
    60 set SBS_CALL=sbs --config winscw_udeb.test --keepgoing BUILD
       
    61 set PATH_TO_DLL=\epoc32\release\winscw\udeb
       
    62 set PATH_TO_MOVE_DLL=\epoc32\release\winscw\udeb\z\sys\bin
       
    63 set PATH_TO_COVERAGE_DATA=\coverage_data
       
    64 
       
    65 
       
    66 if not exist %PATH_TO_DLL%\eunitexerunner.exe  ( 
       
    67 echo EUnit not installed! 
       
    68 goto end
       
    69 )
       
    70 
       
    71 if not exist %PATH_TO_COVERAGE_DATA% (
       
    72 mkdir %PATH_TO_COVERAGE_DATA%
       
    73 )
       
    74 
       
    75 if [%1] EQU [] ( goto default )
       
    76 
       
    77 call :%1
       
    78 call :%2
       
    79 call :%3
       
    80 call :%4
       
    81 call :%5
       
    82 echo Running tests = %RUNTESTS%
       
    83 echo Instrumenting tests = %INSTRUMENT%
       
    84 goto default
       
    85 
       
    86 :/NOCLEANUP
       
    87 set REMOVEINSTRUMENT=FALSE
       
    88 set REMOVETESTS=FALSE
       
    89 goto end
       
    90 
       
    91 :/NORUN
       
    92 set RUNTESTS=FALSE
       
    93 set REMOVEINSTRUMENT=FALSE
       
    94 set REMOVETESTS=FALSE
       
    95 goto end
       
    96 
       
    97 :/NOINSTRUMENT
       
    98 set INSTRUMENT=FALSE
       
    99 goto end
       
   100 
       
   101 :/NOBUILD
       
   102 set BUILDTESTS=FALSE
       
   103 goto end
       
   104 
       
   105 :/ONLYUNITTESTS
       
   106 set DOMODULESTESTS=FALSE
       
   107 goto end
       
   108 
       
   109 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   110 :: function FINISH
       
   111 ::
       
   112 :: Finishes run_auto_tests.bat
       
   113 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   114 :FINISH
       
   115 call :move
       
   116 
       
   117 if [%RUNTESTS%] EQU [TRUE] (
       
   118 call :runtests
       
   119 )
       
   120 
       
   121 if [%REMOVETESTS%] EQU [TRUE] (
       
   122 call :removetests
       
   123 )
       
   124 
       
   125 if [%INSTRUMENT%] EQU [TRUE] (
       
   126 call :calculatecoverage
       
   127 )
       
   128 
       
   129 if [%REMOVEINSTRUMENT%] EQU [TRUE] (
       
   130 call :removecoverage
       
   131 )
       
   132 goto end
       
   133 
       
   134 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   135 :: function BUILD
       
   136 ::    param directory
       
   137 ::
       
   138 :: builds test from given directory
       
   139 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   140 :BUILD
       
   141 setlocal
       
   142 if [%BUILDTESTS%] EQU [FALSE] ( goto end )
       
   143 echo Building %1
       
   144 if not exist %1 ( 
       
   145 echo %1 Not found! 
       
   146 goto end
       
   147 )
       
   148 
       
   149 pushd .
       
   150 call cd %1\group
       
   151 call sbs --config winscw_udeb.test --keepgoing CLEAN
       
   152 if [%INSTRUMENT%] EQU [TRUE] (
       
   153 call ctcwrap -n %PATH_TO_COVERAGE_DATA%\%1 -i d -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" "%SBS_CALL%"
       
   154 ) else (
       
   155 call %SBS_CALL%
       
   156 )
       
   157 
       
   158 popd
       
   159 endlocal
       
   160 goto end
       
   161 
       
   162 
       
   163 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   164 :: function MOVE
       
   165 ::
       
   166 :: moves compiled tests to eunit directory
       
   167 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   168 :MOVE
       
   169 echo Moving tests
       
   170 call move %PATH_TO_DLL%\ut_*.dll %PATH_TO_MOVE_DLL%
       
   171 call move %PATH_TO_DLL%\mt_*.dll %PATH_TO_MOVE_DLL%
       
   172 goto end
       
   173 
       
   174 
       
   175 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   176 :: function RUNTESTS
       
   177 ::
       
   178 :: Runs tests in eunit directory
       
   179 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   180 :RUNTESTS
       
   181 echo Running tests
       
   182 call %PATH_TO_DLL%\eunitexerunner.exe -dtextshell --
       
   183 copy \epoc32\winscw\c\shared\EUnit\Logs\EUnit_log.xml \lastrun_EUnit_log.xml
       
   184 goto end
       
   185 
       
   186 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   187 :: function CALCULATECOVERAGE
       
   188 ::
       
   189 :: Calculates test coverage. Generates html
       
   190 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   191 :CALCULATECOVERAGE
       
   192 echo Calculating coverage
       
   193 ctcpost %PATH_TO_COVERAGE_DATA%\*.sym -p - | ctcmerge -i - -o profile.txt
       
   194 call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb
       
   195 goto end
       
   196 
       
   197 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   198 :: function REMOVETESTS
       
   199 ::
       
   200 :: Removes tests from eunit directory
       
   201 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   202 :REMOVETESTS
       
   203 echo Removing Test dlls
       
   204 call sleep 3
       
   205 call del %PATH_TO_MOVE_DLL%\t_*.dll
       
   206 call del %PATH_TO_MOVE_DLL%\mt_*.dll
       
   207 call del %PATH_TO_MOVE_DLL%\ut_*.dll
       
   208 call del %PATH_TO_MOVE_DLL%\it_*.dll
       
   209 goto end
       
   210 
       
   211 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   212 :: function REMOVECOVERAGE
       
   213 ::
       
   214 :: Removes data from coverage directory
       
   215 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   216 :REMOVECOVERAGE
       
   217 echo Removing deleting coverage data
       
   218 call del %PATH_TO_COVERAGE_DATA%\*.sym
       
   219 call del %PATH_TO_COVERAGE_DATA%\*.dat
       
   220 call del profile.txt
       
   221 goto end
       
   222 
       
   223 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   224 :: function END
       
   225 ::
       
   226 :: Prints done
       
   227 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   228 :END
       
   229 echo Done!