mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Copy Valgrind scripts that was deleted from Chromium's tools/ to fix the Memcheck bot:
valgrind/chrome_tests.bat
valgrind/chrome_tests.py
valgrind/chrome_tests.sh
valgrind/common.py
valgrind/gdb_helper.py
valgrind/locate_valgrind.sh
valgrind/memcheck_analyze.py
valgrind/valgrind.gni
valgrind/valgrind.sh
valgrind/valgrind_test.py
valgrind_test.py was stripped of its Mac and Dr Memory specific parts, which
we don't use. There's still more cleanup to do, tracked in bugs.webrc.org/7849.
This is similar to changes in https://codereview.webrtc.org/2945753002.
BUG=libyuv:714
NOTRY=True
Change-Id: Ia6ba9bd3d3fca6f2ebe0e4f30e1eb39bb1a66813
Reviewed-on: https://chromium-review.googlesource.com/615162
Reviewed-by: Henrik Kjellander <kjellander@chromium.org>
Commit-Queue: Henrik Kjellander <kjellander@chromium.org>
95 lines
2.7 KiB
Bash
Executable File
95 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
#
|
|
# Use of this source code is governed by a BSD-style license
|
|
# that can be found in the LICENSE file in the root of the source
|
|
# tree. An additional intellectual property rights grant can be found
|
|
# in the file PATENTS. All contributing project authors may
|
|
# be found in the AUTHORS file in the root of the source tree.
|
|
|
|
# Set up some paths and re-direct the arguments to chrome_tests.py
|
|
|
|
export THISDIR=`dirname $0`
|
|
ARGV_COPY="$@"
|
|
|
|
# We need to set CHROME_VALGRIND iff using Memcheck:
|
|
# tools/valgrind/chrome_tests.sh --tool memcheck
|
|
# or
|
|
# tools/valgrind/chrome_tests.sh --tool=memcheck
|
|
tool="memcheck" # Default to memcheck.
|
|
while (( "$#" ))
|
|
do
|
|
if [[ "$1" == "--tool" ]]
|
|
then
|
|
tool="$2"
|
|
shift
|
|
elif [[ "$1" =~ --tool=(.*) ]]
|
|
then
|
|
tool="${BASH_REMATCH[1]}"
|
|
fi
|
|
shift
|
|
done
|
|
|
|
NEEDS_VALGRIND=0
|
|
NEEDS_DRMEMORY=0
|
|
|
|
case "$tool" in
|
|
"memcheck")
|
|
NEEDS_VALGRIND=1
|
|
;;
|
|
"drmemory" | "drmemory_light" | "drmemory_full" | "drmemory_pattern")
|
|
NEEDS_DRMEMORY=1
|
|
;;
|
|
esac
|
|
|
|
if [ "$NEEDS_VALGRIND" == "1" ]
|
|
then
|
|
export CHROME_VALGRIND=`sh $THISDIR/locate_valgrind.sh`
|
|
if [ "$CHROME_VALGRIND" = "" ]
|
|
then
|
|
# locate_valgrind.sh failed
|
|
exit 1
|
|
fi
|
|
echo "Using valgrind binaries from ${CHROME_VALGRIND}"
|
|
|
|
PATH="${CHROME_VALGRIND}/bin:$PATH"
|
|
# We need to set these variables to override default lib paths hard-coded into
|
|
# Valgrind binary.
|
|
export VALGRIND_LIB="$CHROME_VALGRIND/lib/valgrind"
|
|
export VALGRIND_LIB_INNER="$CHROME_VALGRIND/lib/valgrind"
|
|
|
|
# Clean up some /tmp directories that might be stale due to interrupted
|
|
# chrome_tests.py execution.
|
|
# FYI:
|
|
# -mtime +1 <- only print files modified more than 24h ago,
|
|
# -print0/-0 are needed to handle possible newlines in the filenames.
|
|
echo "Cleanup /tmp from Valgrind stuff"
|
|
find /tmp -maxdepth 1 \(\
|
|
-name "vgdb-pipe-*" -or -name "vg_logs_*" -or -name "valgrind.*" \
|
|
\) -mtime +1 -print0 | xargs -0 rm -rf
|
|
fi
|
|
|
|
if [ "$NEEDS_DRMEMORY" == "1" ]
|
|
then
|
|
if [ -z "$DRMEMORY_COMMAND" ]
|
|
then
|
|
DRMEMORY_PATH="$THISDIR/../../third_party/drmemory"
|
|
DRMEMORY_SFX="$DRMEMORY_PATH/drmemory-windows-sfx.exe"
|
|
if [ ! -f "$DRMEMORY_SFX" ]
|
|
then
|
|
echo "Can't find Dr. Memory executables."
|
|
echo "See http://www.chromium.org/developers/how-tos/using-valgrind/dr-memory"
|
|
echo "for the instructions on how to get them."
|
|
exit 1
|
|
fi
|
|
|
|
chmod +x "$DRMEMORY_SFX" # Cygwin won't run it without +x.
|
|
"$DRMEMORY_SFX" -o"$DRMEMORY_PATH/unpacked" -y
|
|
export DRMEMORY_COMMAND="$DRMEMORY_PATH/unpacked/bin/drmemory.exe"
|
|
fi
|
|
fi
|
|
|
|
PYTHONPATH=$THISDIR/../python/google python \
|
|
"$THISDIR/chrome_tests.py" $ARGV_COPY
|