media/libyuv/tools/valgrind-libyuv/libyuv_tests.bat

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libyuv/tools/valgrind-libyuv/libyuv_tests.bat	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,79 @@
     1.4 +@echo off
     1.5 +:: Copyright (c) 2012 The LibYuv Project Authors. All rights reserved.
     1.6 +::
     1.7 +:: Use of this source code is governed by a BSD-style license
     1.8 +:: that can be found in the LICENSE file in the root of the source
     1.9 +:: tree. An additional intellectual property rights grant can be found
    1.10 +:: in the file PATENTS.  All contributing project authors may
    1.11 +:: be found in the AUTHORS file in the root of the source tree.
    1.12 +
    1.13 +:: This script is a copy of chrome_tests.bat with the following changes:
    1.14 +:: - Invokes libyuv_tests.py instead of chrome_tests.py
    1.15 +:: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make
    1.16 +::   it possible to execute the Python scripts properly.
    1.17 +
    1.18 +:: TODO(timurrrr): batch files 'export' all the variables to the parent shell
    1.19 +set THISDIR=%~dp0
    1.20 +set TOOL_NAME="unknown"
    1.21 +
    1.22 +:: Get the tool name and put it into TOOL_NAME {{{1
    1.23 +:: NB: SHIFT command doesn't modify %*
    1.24 +:PARSE_ARGS_LOOP
    1.25 +  if %1 == () GOTO:TOOLNAME_NOT_FOUND
    1.26 +  if %1 == --tool GOTO:TOOLNAME_FOUND
    1.27 +  SHIFT
    1.28 +  goto :PARSE_ARGS_LOOP
    1.29 +
    1.30 +:TOOLNAME_NOT_FOUND
    1.31 +echo "Please specify a tool (tsan or drmemory) by using --tool flag"
    1.32 +exit /B 1
    1.33 +
    1.34 +:TOOLNAME_FOUND
    1.35 +SHIFT
    1.36 +set TOOL_NAME=%1
    1.37 +:: }}}
    1.38 +if "%TOOL_NAME%" == "drmemory"          GOTO :SETUP_DRMEMORY
    1.39 +if "%TOOL_NAME%" == "drmemory_light"    GOTO :SETUP_DRMEMORY
    1.40 +if "%TOOL_NAME%" == "drmemory_full"     GOTO :SETUP_DRMEMORY
    1.41 +if "%TOOL_NAME%" == "drmemory_pattern"  GOTO :SETUP_DRMEMORY
    1.42 +if "%TOOL_NAME%" == "tsan"     GOTO :SETUP_TSAN
    1.43 +echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported."
    1.44 +exit /B 1
    1.45 +
    1.46 +:SETUP_DRMEMORY
    1.47 +if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS
    1.48 +:: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1
    1.49 +set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory
    1.50 +set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe
    1.51 +if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK
    1.52 +echo "Can't find Dr. Memory executables."
    1.53 +echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
    1.54 +echo "for the instructions on how to get them."
    1.55 +exit /B 1
    1.56 +
    1.57 +:DRMEMORY_BINARY_OK
    1.58 +%DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y
    1.59 +set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe
    1.60 +:: }}}
    1.61 +goto :RUN_TESTS
    1.62 +
    1.63 +:SETUP_TSAN
    1.64 +:: Set up PIN_COMMAND to invoke TSan {{{1
    1.65 +set TSAN_PATH=%THISDIR%..\..\third_party\tsan
    1.66 +set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe
    1.67 +if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK
    1.68 +echo "Can't find ThreadSanitizer executables."
    1.69 +echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
    1.70 +echo "for the instructions on how to get them."
    1.71 +exit /B 1
    1.72 +
    1.73 +:TSAN_BINARY_OK
    1.74 +%TSAN_SFX% -o%TSAN_PATH%\unpacked -y
    1.75 +set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat
    1.76 +:: }}}
    1.77 +goto :RUN_TESTS
    1.78 +
    1.79 +:RUN_TESTS
    1.80 +set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind
    1.81 +set RUNNING_ON_VALGRIND=yes
    1.82 +python %THISDIR%libyuv_tests.py %*

mercurial