OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2012 the V8 project authors. All rights reserved. | 2 # Copyright 2012 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 18 matching lines...) Expand all Loading... | |
29 # A simple harness that downloads and runs 'jsfunfuzz' against d8. This | 29 # A simple harness that downloads and runs 'jsfunfuzz' against d8. This |
30 # takes a long time because it runs many iterations and is intended for | 30 # takes a long time because it runs many iterations and is intended for |
31 # automated usage. The package containing 'jsfunfuzz' can be found as an | 31 # automated usage. The package containing 'jsfunfuzz' can be found as an |
32 # attachment to this bug: | 32 # attachment to this bug: |
33 # https://bugzilla.mozilla.org/show_bug.cgi?id=jsfunfuzz | 33 # https://bugzilla.mozilla.org/show_bug.cgi?id=jsfunfuzz |
34 | 34 |
35 JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631" | 35 JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631" |
36 JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32" | 36 JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32" |
37 | 37 |
38 v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) | 38 v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) |
39 jsfunfuzz_dir="$v8_root/tools/jsfunfuzz" | |
39 | 40 |
40 if [ -n "$1" ]; then | 41 if [ -n "$1" ]; then |
41 d8="${v8_root}/$1" | 42 d8="${v8_root}/$1" |
42 else | 43 else |
43 d8="${v8_root}/d8" | 44 d8="${v8_root}/d8" |
44 fi | 45 fi |
45 | 46 |
46 if [ ! -f "$d8" ]; then | 47 if [ ! -f "$d8" ]; then |
47 echo "Failed to find d8 binary: $d8" | 48 echo "Failed to find d8 binary: $d8" |
48 exit 1 | 49 exit 1 |
49 fi | 50 fi |
50 | 51 |
51 jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip" | 52 # Deprecated download method. A prepatched archive is downloaded as a hook |
52 if [ ! -f "$jsfunfuzz_file" ]; then | 53 # if jsfunfuzz=1 is specified as a gyp flag. Requires google.com authentication |
53 echo "Downloading $jsfunfuzz_file ..." | 54 # for google storage. |
54 wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1 | 55 if [ "$2" == "--download" ]; then |
55 fi | |
56 | 56 |
Michael Achenbach
2016/02/18 09:03:49
There should be only indentation here and one line
| |
57 jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }') | 57 jsfunfuzz_file="$v8_root/tools/jsfunfuzz.zip" |
58 if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then | 58 if [ ! -f "$jsfunfuzz_file" ]; then |
59 echo "Failed to verify checksum!" | 59 echo "Downloading $jsfunfuzz_file ..." |
60 exit 1 | 60 wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1 |
61 fi | 61 fi |
62 | 62 |
63 jsfunfuzz_dir="$v8_root/tools/jsfunfuzz" | 63 jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }') |
64 if [ ! -d "$jsfunfuzz_dir" ]; then | 64 if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then |
65 echo "Unpacking into $jsfunfuzz_dir ..." | 65 echo "Failed to verify checksum!" |
66 unzip "$jsfunfuzz_file" -d "$jsfunfuzz_dir" || exit 1 | 66 exit 1 |
67 echo "Patching runner ..." | 67 fi |
68 cat << EOF | patch -s -p0 -d "$v8_root" | 68 |
69 if [ ! -d "$jsfunfuzz_dir" ]; then | |
70 echo "Unpacking into $jsfunfuzz_dir ..." | |
71 unzip "$jsfunfuzz_file" -d "$jsfunfuzz_dir" || exit 1 | |
72 echo "Patching runner ..." | |
73 cat << EOF | patch -s -p0 -d "$v8_root" | |
69 --- tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py~ | 74 --- tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py~ |
70 +++ tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py | 75 +++ tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py |
71 @@ -125,7 +125,7 @@ | 76 @@ -125,7 +125,7 @@ |
72 | 77 |
73 def many_timed_runs(): | 78 def many_timed_runs(): |
74 iteration = 0 | 79 iteration = 0 |
75 - while True: | 80 - while True: |
76 + while iteration < 100: | 81 + while iteration < 100: |
77 iteration += 1 | 82 iteration += 1 |
78 logfilename = "w%d" % iteration | 83 logfilename = "w%d" % iteration |
79 one_timed_run(logfilename) | 84 one_timed_run(logfilename) |
80 EOF | 85 EOF |
86 fi | |
87 | |
81 fi | 88 fi |
82 | 89 |
83 flags='--debug-code --expose-gc --verify-gc' | 90 flags='--debug-code --expose-gc --verify-gc' |
84 python -u "$jsfunfuzz_dir/jsfunfuzz/multi_timed_run.py" 300 \ | 91 python -u "$jsfunfuzz_dir/jsfunfuzz/multi_timed_run.py" 300 \ |
85 "$d8" $flags "$jsfunfuzz_dir/jsfunfuzz/jsfunfuzz.js" | 92 "$d8" $flags "$jsfunfuzz_dir/jsfunfuzz/jsfunfuzz.js" |
86 exit_code=$(cat w* | grep " looking good" -c) | 93 exit_code=$(cat w* | grep " looking good" -c) |
87 exit_code=$((100-exit_code)) | 94 exit_code=$((100-exit_code)) |
88 archive=fuzz-results-$(date +%Y%m%d%H%M%S).tar.bz2 | 95 archive=fuzz-results-$(date +%Y%m%d%H%M%S).tar.bz2 |
89 echo "Creating archive $archive" | 96 echo "Creating archive $archive" |
90 tar -cjf $archive err-* w* | 97 tar -cjf $archive err-* w* |
91 rm -f err-* w* | 98 rm -f err-* w* |
92 | 99 |
93 echo "Total failures: $exit_code" | 100 echo "Total failures: $exit_code" |
94 exit $exit_code | 101 exit $exit_code |
OLD | NEW |