Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tools/testrunner/server/signatures.py

Issue 10919265: First commit of new tools/run-tests.py (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: s/server.py/test-server.py/ in README Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testrunner/server/presence_handler.py ('k') | tools/testrunner/server/status_handler.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash
2 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
5 # met: 4 # met:
6 # 5 #
7 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
11 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
12 # with the distribution. 11 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its 12 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived 13 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission. 14 # from this software without specific prior written permission.
16 # 15 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 27
29 # Checks that the number of compilation units having at least one static
30 # initializer in d8 matches the one defined below.
31 # Note that the project must be built with SCons before running this script.
32 28
33 # Allow: 29 import base64
34 # - _GLOBAL__I__ZN2v810LineEditor6first_E 30 import os
35 # - _GLOBAL__I__ZN2v88internal32AtomicOps_Internalx86CPUFeaturesE 31 import subprocess
36 # - _GLOBAL__I__ZN2v88internal8ThreadId18highest_thread_id_E
37 expected_static_init_count=3
38 32
39 v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
40 33
41 if [ -n "$1" ] ; then 34 def ReadFileAndSignature(filename):
42 d8="${v8_root}/$1" 35 with open(filename, "rb") as f:
43 else 36 file_contents = base64.b64encode(f.read())
44 d8="${v8_root}/d8" 37 signature_file = filename + ".signature"
45 fi 38 if (not os.path.exists(signature_file) or
39 os.path.getmtime(signature_file) < os.path.getmtime(filename)):
40 private_key = "~/.ssh/v8_dtest"
41 code = subprocess.call("openssl dgst -out %s -sign %s %s" %
42 (signature_file, private_key, filename),
43 shell=True)
44 if code != 0: return [None, code]
45 with open(signature_file) as f:
46 signature = base64.b64encode(f.read())
47 return [file_contents, signature]
46 48
47 if [ ! -f "$d8" ]; then
48 echo "d8 binary not found: $d8"
49 exit 1
50 fi
51 49
52 static_inits=$(nm "$d8" | grep _GLOBAL_ | grep _I_ | awk '{ print $NF; }') 50 def VerifySignature(filename, file_contents, signature, pubkeyfile):
53 51 with open(filename, "wb") as f:
54 static_init_count=$(echo "$static_inits" | wc -l) 52 f.write(base64.b64decode(file_contents))
55 53 signature_file = filename + ".foreign_signature"
56 if [ $static_init_count -gt $expected_static_init_count ]; then 54 with open(signature_file, "wb") as f:
57 echo "Too many static initializers." 55 f.write(base64.b64decode(signature))
58 echo "$static_inits" 56 code = subprocess.call("openssl dgst -verify %s -signature %s %s" %
59 exit 1 57 (pubkeyfile, signature_file, filename),
60 else 58 shell=True)
61 echo "Static initializer check passed ($static_init_count initializers)." 59 matched = (code == 0)
62 exit 0 60 if not matched:
63 fi 61 os.remove(signature_file)
62 os.remove(filename)
63 return matched
OLDNEW
« no previous file with comments | « tools/testrunner/server/presence_handler.py ('k') | tools/testrunner/server/status_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698