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

Side by Side Diff: tools/isolate/isolate_test.py

Issue 9834052: [strace] Add support for interrupted calls and proper chdir handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test again Created 8 years, 8 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/isolate/isolate.py ('k') | tools/isolate/trace_inputs.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if not read_only: 48 if not read_only:
49 min_mode |= 0200 49 min_mode |= 0200
50 def mode(filename): 50 def mode(filename):
51 return (min_mode | 0111) if filename.endswith('.py') else min_mode 51 return (min_mode | 0111) if filename.endswith('.py') else min_mode
52 expected = { 52 expected = {
53 u'command': 53 u'command':
54 [unicode(sys.executable)] + 54 [unicode(sys.executable)] +
55 [unicode(x) for x in args], 55 [unicode(x) for x in args],
56 u'files': dict((unicode(f), {u'mode': mode(f)}) for f in files), 56 u'files': dict((unicode(f), {u'mode': mode(f)}) for f in files),
57 u'relative_cwd': u'.', 57 u'relative_cwd': u'.',
58 u'read_only': False,
58 } 59 }
59 if with_hash: 60 if with_hash:
60 for filename in expected[u'files']: 61 for filename in expected[u'files']:
61 # Calculate our hash. 62 # Calculate our hash.
62 h = hashlib.sha1() 63 h = hashlib.sha1()
63 h.update(open(os.path.join(ROOT_DIR, filename), 'rb').read()) 64 h.update(open(os.path.join(ROOT_DIR, filename), 'rb').read())
64 expected[u'files'][filename][u'sha-1'] = h.hexdigest() 65 expected[u'files'][filename][u'sha-1'] = h.hexdigest()
65 66
66 actual = json.load(open(self.result, 'rb')) 67 actual = json.load(open(self.result, 'rb'))
67 self.assertEquals(expected, actual) 68 self.assertEquals(expected, actual)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if sys.argv[1] == '--ok': 254 if sys.argv[1] == '--ok':
254 return 0 255 return 0
255 if sys.argv[1] == '--fail': 256 if sys.argv[1] == '--fail':
256 return 1 257 return 1
257 258
258 unittest.main() 259 unittest.main()
259 260
260 261
261 if __name__ == '__main__': 262 if __name__ == '__main__':
262 sys.exit(main()) 263 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/isolate/isolate.py ('k') | tools/isolate/trace_inputs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698