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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 @echo off
michael@0 2 :: Copyright (c) 2012 The LibYuv Project Authors. All rights reserved.
michael@0 3 ::
michael@0 4 :: Use of this source code is governed by a BSD-style license
michael@0 5 :: that can be found in the LICENSE file in the root of the source
michael@0 6 :: tree. An additional intellectual property rights grant can be found
michael@0 7 :: in the file PATENTS. All contributing project authors may
michael@0 8 :: be found in the AUTHORS file in the root of the source tree.
michael@0 9
michael@0 10 :: This script is a copy of chrome_tests.bat with the following changes:
michael@0 11 :: - Invokes libyuv_tests.py instead of chrome_tests.py
michael@0 12 :: - Chromium's Valgrind scripts directory is added to the PYTHONPATH to make
michael@0 13 :: it possible to execute the Python scripts properly.
michael@0 14
michael@0 15 :: TODO(timurrrr): batch files 'export' all the variables to the parent shell
michael@0 16 set THISDIR=%~dp0
michael@0 17 set TOOL_NAME="unknown"
michael@0 18
michael@0 19 :: Get the tool name and put it into TOOL_NAME {{{1
michael@0 20 :: NB: SHIFT command doesn't modify %*
michael@0 21 :PARSE_ARGS_LOOP
michael@0 22 if %1 == () GOTO:TOOLNAME_NOT_FOUND
michael@0 23 if %1 == --tool GOTO:TOOLNAME_FOUND
michael@0 24 SHIFT
michael@0 25 goto :PARSE_ARGS_LOOP
michael@0 26
michael@0 27 :TOOLNAME_NOT_FOUND
michael@0 28 echo "Please specify a tool (tsan or drmemory) by using --tool flag"
michael@0 29 exit /B 1
michael@0 30
michael@0 31 :TOOLNAME_FOUND
michael@0 32 SHIFT
michael@0 33 set TOOL_NAME=%1
michael@0 34 :: }}}
michael@0 35 if "%TOOL_NAME%" == "drmemory" GOTO :SETUP_DRMEMORY
michael@0 36 if "%TOOL_NAME%" == "drmemory_light" GOTO :SETUP_DRMEMORY
michael@0 37 if "%TOOL_NAME%" == "drmemory_full" GOTO :SETUP_DRMEMORY
michael@0 38 if "%TOOL_NAME%" == "drmemory_pattern" GOTO :SETUP_DRMEMORY
michael@0 39 if "%TOOL_NAME%" == "tsan" GOTO :SETUP_TSAN
michael@0 40 echo "Unknown tool: `%TOOL_NAME%`! Only tsan and drmemory are supported."
michael@0 41 exit /B 1
michael@0 42
michael@0 43 :SETUP_DRMEMORY
michael@0 44 if NOT "%DRMEMORY_COMMAND%"=="" GOTO :RUN_TESTS
michael@0 45 :: Set up DRMEMORY_COMMAND to invoke Dr. Memory {{{1
michael@0 46 set DRMEMORY_PATH=%THISDIR%..\..\third_party\drmemory
michael@0 47 set DRMEMORY_SFX=%DRMEMORY_PATH%\drmemory-windows-sfx.exe
michael@0 48 if EXIST %DRMEMORY_SFX% GOTO DRMEMORY_BINARY_OK
michael@0 49 echo "Can't find Dr. Memory executables."
michael@0 50 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
michael@0 51 echo "for the instructions on how to get them."
michael@0 52 exit /B 1
michael@0 53
michael@0 54 :DRMEMORY_BINARY_OK
michael@0 55 %DRMEMORY_SFX% -o%DRMEMORY_PATH%\unpacked -y
michael@0 56 set DRMEMORY_COMMAND=%DRMEMORY_PATH%\unpacked\bin\drmemory.exe
michael@0 57 :: }}}
michael@0 58 goto :RUN_TESTS
michael@0 59
michael@0 60 :SETUP_TSAN
michael@0 61 :: Set up PIN_COMMAND to invoke TSan {{{1
michael@0 62 set TSAN_PATH=%THISDIR%..\..\third_party\tsan
michael@0 63 set TSAN_SFX=%TSAN_PATH%\tsan-x86-windows-sfx.exe
michael@0 64 if EXIST %TSAN_SFX% GOTO TSAN_BINARY_OK
michael@0 65 echo "Can't find ThreadSanitizer executables."
michael@0 66 echo "See http://www.chromium.org/developers/how-tos/using-valgrind/threadsanitizer/threadsanitizer-on-windows"
michael@0 67 echo "for the instructions on how to get them."
michael@0 68 exit /B 1
michael@0 69
michael@0 70 :TSAN_BINARY_OK
michael@0 71 %TSAN_SFX% -o%TSAN_PATH%\unpacked -y
michael@0 72 set PIN_COMMAND=%TSAN_PATH%\unpacked\tsan-x86-windows\tsan.bat
michael@0 73 :: }}}
michael@0 74 goto :RUN_TESTS
michael@0 75
michael@0 76 :RUN_TESTS
michael@0 77 set PYTHONPATH=%THISDIR%..\python\google;%THISDIR%..\valgrind
michael@0 78 set RUNNING_ON_VALGRIND=yes
michael@0 79 python %THISDIR%libyuv_tests.py %*

mercurial