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