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