|
1 @echo off |
|
2 :: Copyright (c) 2012 The LibYuv 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 libyuv_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 |
|
16 set THISDIR=%~dp0 |
|
17 set 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 |
|
28 echo "Please specify a tool (tsan or drmemory) by using --tool flag" |
|
29 exit /B 1 |
|
30 |
|
31 :TOOLNAME_FOUND |
|
32 SHIFT |
|
33 set TOOL_NAME=%1 |
|
34 :: }}} |
|
35 if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY |
|
36 if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY |
|
37 if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY |
|
38 if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY |
|
39 if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN |
|
40 echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported." |
|
41 exit /B 1 |
|
42 |
|
43 :SETUP_DRMEMORY |
|
44 if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS |
|
45 :: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1 |
|
46 set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory |
|
47 set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe |
|
48 if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK |
|
49 echo "Can't find Dr. Memory executables." |
|
50 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory" |
|
51 echo "for the instructions on how to get them." |
|
52 exit /B 1 |
|
53 |
|
54 :DRMEMORY_BINARY_OK |
|
55 %DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y |
|
56 set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe |
|
57 :: }}} |
|
58 goto :RUN_TESTS |
|
59 |
|
60 :SETUP_TSAN |
|
61 :: Set up PIN_COMMAND to invoke TSan {{{1 |
|
62 set TSAN_PATH=%THISDIR%..\..\third_party\tsan |
|
63 set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe |
|
64 if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK |
|
65 echo "Can't find ThreadSanitizer executables." |
|
66 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows" |
|
67 echo "for the instructions on how to get them." |
|
68 exit /B 1 |
|
69 |
|
70 :TSAN_BINARY_OK |
|
71 %TSAN_SFX% -o%TSAN_PATH%\unpacked -y |
|
72 set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat |
|
73 :: }}} |
|
74 goto :RUN_TESTS |
|
75 |
|
76 :RUN_TESTS |
|
77 set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind |
|
78 set RUNNING_ON_VALGRIND=yes |
|
79 python %THISDIR%libyuv_tests.py %* |