phonesettings/cpphonesettingsplugins/cpnetworkplugin/tsrc/run_auto_tests_qt.bat
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 14:58:25 +0300
changeset 22 6bb1b21d2484
parent 21 92ab7f8d0eab
child 27 2f8f8080a020
permissions -rw-r--r--
Revision: 201011 Kit: 201015

rem
rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
rem All rights reserved.
rem This component and the accompanying materials are made available
rem under the terms of "Eclipse Public License v1.0"
rem which accompanies this distribution, and is available
rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
rem
rem Initial Contributors:
rem Nokia Corporation - initial contribution.
rem
rem Contributors:
rem
rem Description:
rem

@echo off
setlocal
goto :startup 

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function DEFAULT
::
:: Modify this function
::  - TESTED_SRC can be changed to match tested code.
::    Specifies path from testcode group directory to
::    tested code
::  - Add test directories to be runned
::    ie. "call :build ut_projectdirectory" or use
::    "for /f %%a in ('dir /b ut_*') do call :build %%a"
::    which compiles, instruments and runs all test directories
::    starting with "ut_".
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:DEFAULT
set TESTED_SRC=..\..\src\*.cpp

for /f %%a in ('dir /b ut_*') do call :build %%a
if [%DOMODULESTESTS%] EQU [TRUE] (
for /f %%a in ('dir /b mt_*') do call :build %%a
)

call :finish
goto :END

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function STARTUP
::
:: Initializing script
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:STARTUP

set BUILDTESTS=TRUE
set RUNTESTS=TRUE
set INSTRUMENT=TRUE
set REMOVEINSTRUMENT=TRUE
set DOMODULESTESTS=TRUE
set ABLD_CALL=abld build winscw udeb -keepgoing
set PATH_TO_DLL=\epoc32\release\winscw\udeb
set PATH_TO_COVERAGE_DATA=\coverage_data

if not exist %PATH_TO_COVERAGE_DATA% (
mkdir %PATH_TO_COVERAGE_DATA%
)

if [%1] EQU [] ( goto default )

call :%1
call :%2
call :%3
call :%4
call :%5
echo Running tests = %RUNTESTS%
echo Instrumenting tests = %INSTRUMENT%
goto default

:/NOCLEANUP
set REMOVEINSTRUMENT=FALSE
goto end

:/NORUN
set RUNTESTS=FALSE
set REMOVEINSTRUMENT=FALSE
goto end

:/NOINSTRUMENT
set INSTRUMENT=FALSE
goto end

:/NOBUILD
set BUILDTESTS=FALSE
goto end

:/ONLYUNITTESTS
set DOMODULESTESTS=FALSE
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function FINISH
::
:: Finishes run_auto_tests.bat
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:FINISH

if [%RUNTESTS%] EQU [TRUE] (
call :runtests
)

if [%INSTRUMENT%] EQU [TRUE] (
call :calculatecoverage
)

if [%REMOVEINSTRUMENT%] EQU [TRUE] (
call :removecoverage
)
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function BUILD
::    param directory
::
:: builds test from given directory
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:BUILD
setlocal
if [%BUILDTESTS%] EQU [FALSE] ( goto end )
echo Building %1
if not exist %1 ( 
echo %1 Not found! 
goto end
)

pushd .
call cd %1
call qmake
call bldmake bldfiles
call abld clean winscw udeb
if [%INSTRUMENT%] EQU [TRUE] (
call ctcwrap -n %PATH_TO_COVERAGE_DATA%\%1 -i d -C "EXCLUDE=*" -C "NO_EXCLUDE=%TESTED_SRC%" %ABLD_CALL%
) else (
call %ABLD_CALL%
)

popd
endlocal
goto end


::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function RUNTESTS
::
:: NOTE! Function assumes that test binary is named according to test directory.
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:RUNTESTS
echo Running tests
for /f %%a in ('dir /b ut_*') do call %PATH_TO_DLL%\%%a.exe
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function CALCULATECOVERAGE
::
:: Calculates test coverage. Generates html
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:CALCULATECOVERAGE
echo Calculating coverage
ctcpost %PATH_TO_COVERAGE_DATA%\*.sym | ctcmerge -i - -o profile.txt
call ctc2html -t 70 -i profile.txt -o \coverage_result -nsb
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function REMOVECOVERAGE
::
:: Removes data from coverage directory
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:REMOVECOVERAGE
echo Removing deleting coverage data
call del %PATH_TO_COVERAGE_DATA%\*.sym
call del %PATH_TO_COVERAGE_DATA%\*.dat
call del profile.txt
goto end

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: function END
::
:: Prints done
::::::::::::::::::::::::::::::::::::::::::::::::::::::
:END
echo Done!