1@echo off 2:: Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3:: 4:: Use of this source code is governed by a BSD-style license 5:: that can be found in the LICENSE file in the root of the source 6:: tree. An additional intellectual property rights grant can be found 7:: in the file PATENTS. All contributing project authors may 8:: be found in the AUTHORS file in the root of the source tree. 9 10:: This script is a copy of chrome_tests.bat with the following changes: 11:: - Invokes webrtc_tests.py instead of chrome_tests.py 12:: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make 13:: it possible to execute the Python scripts properly. 14 15:: TODO(timurrrr): batch files 'export' all the variables to the parent shell 16set THISDIR=%~dp0 17set TOOL_NAME="unknown" 18 19:: Get the tool name and put it into TOOL_NAME {{{1 20:: NB: SHIFT command doesn't modify %* 21:PARSE_ARGS_LOOP 22 if %1 == () GOTO:TOOLNAME_NOT_FOUND 23 if %1 == --tool GOTO:TOOLNAME_FOUND 24 SHIFT 25 goto :PARSE_ARGS_LOOP 26 27:TOOLNAME_NOT_FOUND 28echo "Please specify a tool (drmemory, drmemory_light or drmemory_full)" 29echo "by using --tool flag" 30exit /B 1 31 32:TOOLNAME_FOUND 33SHIFT 34set TOOL_NAME=%1 35:: }}} 36if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY 37if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY 38if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY 39if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY 40echo "Unknown tool: `%TOOL_NAME%`! Only drmemory* tools are supported." 41exit /B 1 42 43:SETUP_DRMEMORY 44if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS 45:: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1 46set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory 47set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe 48if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK 49echo "Can't find Dr. Memory executables." 50echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory" 51echo "for the instructions on how to get them." 52exit /B 1 53 54:DRMEMORY_BINARY_OK 55%DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y 56set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe 57:: }}} 58goto :RUN_TESTS 59 60:RUN_TESTS 61set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind 62set RUNNING_ON_VALGRIND=yes 63python %THISDIR%webrtc_tests.py %* 64