From 7a9ebb5846f3870efba798671e5d057ef3f11850 Mon Sep 17 00:00:00 2001 From: machenbach Date: Thu, 18 Feb 2016 01:47:23 -0800 Subject: [PATCH] [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} --- .gitignore | 4 +-- DEPS | 8 ++++++ tools/fuzz-harness.sh | 39 ++++++++++++++++----------- tools/jsfunfuzz/download_jsfunfuzz.py | 22 +++++++++++++++ tools/jsfunfuzz/jsfunfuzz.tar.gz.sha1 | 1 + 5 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 tools/jsfunfuzz/download_jsfunfuzz.py create mode 100644 tools/jsfunfuzz/jsfunfuzz.tar.gz.sha1 diff --git a/.gitignore b/.gitignore index 644c087400..731a1dacb3 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/DEPS b/DEPS index 8ae01297e9..92b6dfb115 100644 --- a/DEPS +++ b/DEPS @@ -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', diff --git a/tools/fuzz-harness.sh b/tools/fuzz-harness.sh index 31023de3ab..8e7f133c26 100755 --- a/tools/fuzz-harness.sh +++ b/tools/fuzz-harness.sh @@ -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' diff --git a/tools/jsfunfuzz/download_jsfunfuzz.py b/tools/jsfunfuzz/download_jsfunfuzz.py new file mode 100644 index 0000000000..19eff02438 --- /dev/null +++ b/tools/jsfunfuzz/download_jsfunfuzz.py @@ -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.' diff --git a/tools/jsfunfuzz/jsfunfuzz.tar.gz.sha1 b/tools/jsfunfuzz/jsfunfuzz.tar.gz.sha1 new file mode 100644 index 0000000000..449996007d --- /dev/null +++ b/tools/jsfunfuzz/jsfunfuzz.tar.gz.sha1 @@ -0,0 +1 @@ +d92e66273ea2a0da89456a977edd0224a8e837e9 \ No newline at end of file