[Swarming] Bundle jsfunfuzz.

This downloads a patched version of jsfunfuzz from google
storage (google internal bucket) as a hook on demand.

Similar to the gcmole approach from
https://codereview.chromium.org/1703533002/

BUG=chromium:535160
LOG=n

Review URL: https://codereview.chromium.org/1706963005

Cr-Commit-Position: refs/heads/master@{#34106}
This commit is contained in:
machenbach 2016-02-18 01:47:23 -08:00 committed by Commit bot
parent 953874e974
commit 7a9ebb5846
5 changed files with 56 additions and 18 deletions

4
.gitignore vendored
View File

@ -68,8 +68,8 @@ shell_g
/tools/clang
/tools/gcmole/gcmole-tools
/tools/gcmole/gcmole-tools.tar.gz
/tools/jsfunfuzz
/tools/jsfunfuzz.zip
/tools/jsfunfuzz/jsfunfuzz
/tools/jsfunfuzz/jsfunfuzz.tar.gz
/tools/luci-go/linux64/isolate
/tools/luci-go/mac64/isolate
/tools/luci-go/win64/isolate.exe

8
DEPS
View File

@ -110,6 +110,14 @@ hooks = [
'v8/tools/gcmole/download_gcmole_tools.py',
],
},
{
'name': 'jsfunfuzz',
'pattern': '.',
'action': [
'python',
'v8/tools/jsfunfuzz/download_jsfunfuzz.py',
],
},
# Pull luci-go binaries (isolate, swarming) using checked-in hashes.
{
'name': 'luci-go_win',

View File

@ -36,6 +36,7 @@ JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631"
JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32"
v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
jsfunfuzz_dir="$v8_root/tools/jsfunfuzz"
if [ -n "$1" ]; then
d8="${v8_root}/$1"
@ -48,24 +49,28 @@ if [ ! -f "$d8" ]; then
exit 1
fi
jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip"
if [ ! -f "$jsfunfuzz_file" ]; then
echo "Downloading $jsfunfuzz_file ..."
wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1
fi
# Deprecated download method. A prepatched archive is downloaded as a hook
# if jsfunfuzz=1 is specified as a gyp flag. Requires google.com authentication
# for google storage.
if [ "$2" == "--download" ]; then
jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }')
if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then
echo "Failed to verify checksum!"
exit 1
fi
jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip"
if [ ! -f "$jsfunfuzz_file" ]; then
echo "Downloading $jsfunfuzz_file ..."
wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1
fi
jsfunfuzz_dir="$v8_root/tools/jsfunfuzz"
if [ ! -d "$jsfunfuzz_dir" ]; then
echo "Unpacking into $jsfunfuzz_dir ..."
unzip "$jsfunfuzz_file" -d "$jsfunfuzz_dir" || exit 1
echo "Patching runner ..."
cat << EOF | patch -s -p0 -d "$v8_root"
jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }')
if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then
echo "Failed to verify checksum!"
exit 1
fi
if [ ! -d "$jsfunfuzz_dir" ]; then
echo "Unpacking into $jsfunfuzz_dir ..."
unzip "$jsfunfuzz_file" -d "$jsfunfuzz_dir" || exit 1
echo "Patching runner ..."
cat << EOF | patch -s -p0 -d "$v8_root"
--- tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py~
+++ tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py
@@ -125,7 +125,7 @@
@ -78,6 +83,8 @@ if [ ! -d "$jsfunfuzz_dir" ]; then
logfilename = "w%d" % iteration
one_timed_run(logfilename)
EOF
fi
fi
flags='--debug-code --expose-gc --verify-gc'

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
# Copyright 2016 the V8 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.
import os
import re
import subprocess
FUZZ_PATH = os.path.dirname(os.path.abspath(__file__))
SHA1_PATH = os.path.join(FUZZ_PATH, 'jsfunfuzz.tar.gz.sha1')
if re.search(r'\bjsfunfuzz=1', os.environ.get('GYP_DEFINES', '')):
subprocess.check_call([
'download_from_google_storage',
'-b', 'chrome-v8-jsfunfuzz',
'-u', '--no_resume',
'-s', SHA1_PATH,
'--platform=linux*'
])
else:
print 'Skipping jsfunfuzz download as jsfunfuzz is not set in gyp flags.'

View File

@ -0,0 +1 @@
d92e66273ea2a0da89456a977edd0224a8e837e9