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