James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 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
|
| 7 | set THISDIR=%~dp0
|
| 8 | set 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
|
| 19 | echo "Please specify a tool (tsan or drmemory) by using --tool flag"
|
| 20 | exit /B 1
|
| 21 |
|
| 22 | :TOOLNAME_FOUND
|
| 23 | SHIFT
|
| 24 | set TOOL_NAME=%1
|
| 25 | :: }}}
|
| 26 | if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY
|
| 27 | if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY
|
| 28 | if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY
|
| 29 | if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY
|
| 30 | if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN
|
| 31 | echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported right now"
|
| 32 | exit /B 1
|
| 33 |
|
| 34 | :SETUP_DRMEMORY
|
| 35 | if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS
|
| 36 | :: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1
|
| 37 | set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory
|
| 38 | set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe
|
| 39 | if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK
|
| 40 | echo "Can't find Dr. Memory executables."
|
| 41 | echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
|
| 42 | echo "for the instructions on how to get them."
|
| 43 | exit /B 1
|
| 44 |
|
| 45 | :DRMEMORY_BINARY_OK
|
| 46 | %DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y
|
| 47 | set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe
|
| 48 | :: }}}
|
| 49 | goto :RUN_TESTS
|
| 50 |
|
| 51 | :SETUP_TSAN
|
| 52 | :: Set up PIN_COMMAND to invoke TSan {{{1
|
| 53 | set TSAN_PATH=%THISDIR%..\..\third_party\tsan
|
| 54 | set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe
|
| 55 | if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK
|
| 56 | echo "Can't find ThreadSanitizer executables."
|
| 57 | echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
|
| 58 | echo "for the instructions on how to get them."
|
| 59 | exit /B 1
|
| 60 |
|
| 61 | :TSAN_BINARY_OK
|
| 62 | %TSAN_SFX% -o%TSAN_PATH%\unpacked -y
|
| 63 | set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat
|
| 64 | :: }}}
|
| 65 | goto :RUN_TESTS
|
| 66 |
|
| 67 | :RUN_TESTS
|
| 68 | set PYTHONPATH=%THISDIR%../python/google
|
| 69 | set RUNNING_ON_VALGRIND=yes
|
| 70 | python %THISDIR%/chrome_tests.py %*
|