michael@0: @echo off michael@0: :: Copyright (c) 2012 The LibYuv Project Authors. All rights reserved. michael@0: :: michael@0: :: Use of this source code is governed by a BSD-style license michael@0: :: that can be found in the LICENSE file in the root of the source michael@0: :: tree. An additional intellectual property rights grant can be found michael@0: :: in the file PATENTS. All contributing project authors may michael@0: :: be found in the AUTHORS file in the root of the source tree. michael@0: michael@0: :: This script is a copy of chrome_tests.bat with the following changes: michael@0: :: - Invokes libyuv_tests.py instead of chrome_tests.py michael@0: :: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make michael@0: :: it possible to execute the Python scripts properly. michael@0: michael@0: :: TODO(timurrrr): batch files 'export' all the variables to the parent shell michael@0: set THISDIR=%~dp0 michael@0: set TOOL_NAME="unknown" michael@0: michael@0: :: Get the tool name and put it into TOOL_NAME {{{1 michael@0: :: NB: SHIFT command doesn't modify %* michael@0: :PARSE_ARGS_LOOP michael@0: if %1 == () GOTO:TOOLNAME_NOT_FOUND michael@0: if %1 == --tool GOTO:TOOLNAME_FOUND michael@0: SHIFT michael@0: goto :PARSE_ARGS_LOOP michael@0: michael@0: :TOOLNAME_NOT_FOUND michael@0: echo "Please specify a tool (tsan or drmemory) by using --tool flag" michael@0: exit /B 1 michael@0: michael@0: :TOOLNAME_FOUND michael@0: SHIFT michael@0: set TOOL_NAME=%1 michael@0: :: }}} michael@0: if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY michael@0: if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY michael@0: if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY michael@0: if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY michael@0: if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN michael@0: echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported." michael@0: exit /B 1 michael@0: michael@0: :SETUP_DRMEMORY michael@0: if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS michael@0: :: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1 michael@0: set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory michael@0: set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe michael@0: if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK michael@0: echo "Can't find Dr. Memory executables." michael@0: echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory" michael@0: echo "for the instructions on how to get them." michael@0: exit /B 1 michael@0: michael@0: :DRMEMORY_BINARY_OK michael@0: %DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y michael@0: set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe michael@0: :: }}} michael@0: goto :RUN_TESTS michael@0: michael@0: :SETUP_TSAN michael@0: :: Set up PIN_COMMAND to invoke TSan {{{1 michael@0: set TSAN_PATH=%THISDIR%..\..\third_party\tsan michael@0: set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe michael@0: if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK michael@0: echo "Can't find ThreadSanitizer executables." michael@0: echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows" michael@0: echo "for the instructions on how to get them." michael@0: exit /B 1 michael@0: michael@0: :TSAN_BINARY_OK michael@0: %TSAN_SFX% -o%TSAN_PATH%\unpacked -y michael@0: set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat michael@0: :: }}} michael@0: goto :RUN_TESTS michael@0: michael@0: :RUN_TESTS michael@0: set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind michael@0: set RUNNING_ON_VALGRIND=yes michael@0: python %THISDIR%libyuv_tests.py %*