1@echo off 2:: Copyright (c) 2011 The Chromium Authors. All rights reserved. 3:: Use of this source code is governed by a BSD-style license that can be 4:: found in the LICENSE file. 5 6:: TODO(timurrrr): batch files 'export' all the variables to the parent shell 7set THISDIR=%~dp0 8set TOOL_NAME="unknown" 9 10:: Get the tool name and put it into TOOL_NAME {{{1 11:: NB: SHIFT command doesn't modify %* 12:PARSE_ARGS_LOOP 13 if %1 == () GOTO:TOOLNAME_NOT_FOUND 14 if %1 == --tool GOTO:TOOLNAME_FOUND 15 SHIFT 16 goto :PARSE_ARGS_LOOP 17 18:TOOLNAME_NOT_FOUND 19echo "Please specify a tool (tsan or drmemory) by using --tool flag" 20exit /B 1 21 22:TOOLNAME_FOUND 23SHIFT 24set TOOL_NAME=%1 25:: }}} 26if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY 27if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY 28if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY 29if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY 30if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN 31echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported right now" 32exit /B 1 33 34:SETUP_DRMEMORY 35if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS 36:: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1 37set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory 38set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe 39if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK 40echo "Can't find Dr. Memory executables." 41echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory" 42echo "for the instructions on how to get them." 43exit /B 1 44 45:DRMEMORY_BINARY_OK 46%DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y 47set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe 48:: }}} 49goto :RUN_TESTS 50 51:SETUP_TSAN 52:: Set up PIN_COMMAND to invoke TSan {{{1 53set TSAN_PATH=%THISDIR%..\..\third_party\tsan 54set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe 55if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK 56echo "Can't find ThreadSanitizer executables." 57echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows" 58echo "for the instructions on how to get them." 59exit /B 1 60 61:TSAN_BINARY_OK 62%TSAN_SFX% -o%TSAN_PATH%\unpacked -y 63set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat 64:: }}} 65goto :RUN_TESTS 66 67:RUN_TESTS 68set PYTHONPATH=%THISDIR%../python/google 69set RUNNING_ON_VALGRIND=yes 70python %THISDIR%/chrome_tests.py %* 71