phoneplugins/infowidgetplugin/infowidgetprovider/tsrc/ut_infowidgetsathandler/run_auto_tests_qt.bat
changeset 22 6bb1b21d2484
child 27 2f8f8080a020
equal deleted inserted replaced
21:92ab7f8d0eab 22:6bb1b21d2484
       
     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=..\..\infowidget\src\*.cpp
       
    36 
       
    37 for /f %%a in ('dir /b ut_*') do call :build %%a
       
    38 if [%DOMODULESTESTS%] EQU [TRUE] (
       
    39 for /f %%a in ('dir /b mt_*') do call :build %%a
       
    40 )
       
    41 
       
    42 call :finish
       
    43 goto :END
       
    44 
       
    45 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    46 :: function STARTUP
       
    47 ::
       
    48 :: Initializing script
       
    49 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    50 :STARTUP
       
    51 
       
    52 set BUILDTESTS=TRUE
       
    53 set RUNTESTS=TRUE
       
    54 set INSTRUMENT=TRUE
       
    55 set REMOVEINSTRUMENT=TRUE
       
    56 set DOMODULESTESTS=TRUE
       
    57 set ABLD_CALL=abld build winscw udeb -keepgoing
       
    58 set PATH_TO_DLL=\epoc32\release\winscw\udeb
       
    59 set PATH_TO_COVERAGE_DATA=\coverage_data
       
    60 
       
    61 if not exist %PATH_TO_COVERAGE_DATA% (
       
    62 mkdir %PATH_TO_COVERAGE_DATA%
       
    63 )
       
    64 
       
    65 if [%1] EQU [] ( goto default )
       
    66 
       
    67 call :%1
       
    68 call :%2
       
    69 call :%3
       
    70 call :%4
       
    71 call :%5
       
    72 echo Running tests = %RUNTESTS%
       
    73 echo Instrumenting tests = %INSTRUMENT%
       
    74 goto default
       
    75 
       
    76 :/NOCLEANUP
       
    77 set REMOVEINSTRUMENT=FALSE
       
    78 goto end
       
    79 
       
    80 :/NORUN
       
    81 set RUNTESTS=FALSE
       
    82 set REMOVEINSTRUMENT=FALSE
       
    83 goto end
       
    84 
       
    85 :/NOINSTRUMENT
       
    86 set INSTRUMENT=FALSE
       
    87 goto end
       
    88 
       
    89 :/NOBUILD
       
    90 set BUILDTESTS=FALSE
       
    91 goto end
       
    92 
       
    93 :/ONLYUNITTESTS
       
    94 set DOMODULESTESTS=FALSE
       
    95 goto end
       
    96 
       
    97 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
    98 :: function FINISH
       
    99 ::
       
   100 :: Finishes run_auto_tests.bat
       
   101 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   102 :FINISH
       
   103 
       
   104 if [%RUNTESTS%] EQU [TRUE] (
       
   105 call :runtests
       
   106 )
       
   107 
       
   108 if [%INSTRUMENT%] EQU [TRUE] (
       
   109 call :calculatecoverage
       
   110 )
       
   111 
       
   112 if [%REMOVEINSTRUMENT%] EQU [TRUE] (
       
   113 call :removecoverage
       
   114 )
       
   115 goto end
       
   116 
       
   117 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   118 :: function BUILD
       
   119 ::    param directory
       
   120 ::
       
   121 :: builds test from given directory
       
   122 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   123 :BUILD
       
   124 setlocal
       
   125 if [%BUILDTESTS%] EQU [FALSE] ( goto end )
       
   126 echo Building %1
       
   127 if not exist %1 ( 
       
   128 echo %1 Not found! 
       
   129 goto end
       
   130 )
       
   131 
       
   132 pushd .
       
   133 call cd %1
       
   134 call qmake
       
   135 call bldmake bldfiles
       
   136 call abld clean winscw udeb
       
   137 if [%INSTRUMENT%] EQU [TRUE] (
       
   138 call ctcwrap -n %PATH_TO_COVERAGE_DATA%\%1 -i d -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" %ABLD_CALL%
       
   139 ) else (
       
   140 call %ABLD_CALL%
       
   141 )
       
   142 
       
   143 popd
       
   144 endlocal
       
   145 goto end
       
   146 
       
   147 
       
   148 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   149 :: function RUNTESTS
       
   150 ::
       
   151 :: NOTE! Function assumes that test binary is named according to test directory.
       
   152 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   153 :RUNTESTS
       
   154 echo Running tests
       
   155 call %PATH_TO_DLL%\ut_infowidgetsathandler.exe -dtextshell --
       
   156 goto end
       
   157 
       
   158 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   159 :: function CALCULATECOVERAGE
       
   160 ::
       
   161 :: Calculates test coverage. Generates html
       
   162 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   163 :CALCULATECOVERAGE
       
   164 echo Calculating coverage
       
   165 ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt
       
   166 call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb
       
   167 goto end
       
   168 
       
   169 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   170 :: function REMOVECOVERAGE
       
   171 ::
       
   172 :: Removes data from coverage directory
       
   173 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   174 :REMOVECOVERAGE
       
   175 echo Removing deleting coverage data
       
   176 call del %PATH_TO_COVERAGE_DATA%\*.sym
       
   177 call del %PATH_TO_COVERAGE_DATA%\*.dat
       
   178 call del profile.txt
       
   179 goto end
       
   180 
       
   181 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   182 :: function END
       
   183 ::
       
   184 :: Prints done
       
   185 ::::::::::::::::::::::::::::::::::::::::::::::::::::::
       
   186 :END
       
   187 echo Done!