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

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

Issue 10091011: Added function to get native path case on Windows and OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase against 10080013 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/isolate_test.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 cStringIO 6 import cStringIO
7 import hashlib 7 import hashlib
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 def tearDown(self): 73 def tearDown(self):
74 shutil.rmtree(self.tempdir) 74 shutil.rmtree(self.tempdir)
75 75
76 def _expect_no_tree(self): 76 def _expect_no_tree(self):
77 self.assertFalse(os.path.exists(self.outdir)) 77 self.assertFalse(os.path.exists(self.outdir))
78 78
79 def _result_tree(self): 79 def _result_tree(self):
80 actual = [] 80 actual = []
81 for root, _dirs, files in os.walk(self.outdir): 81 for root, _dirs, files in os.walk(self.outdir):
82 actual.extend(os.path.join(root, f)[len(self.outdir)+1:] for f in files) 82 actual.extend(
83 os.path.join(root, f)[len(self.outdir)+1:].replace(os.path.sep, '/')
84 for f in files)
83 return sorted(actual) 85 return sorted(actual)
84 86
85 def _expected_tree(self): 87 def _expected_tree(self):
86 """Verifies the files written in the temporary directory.""" 88 """Verifies the files written in the temporary directory."""
87 self.assertEquals(sorted(DEPENDENCIES[self.case()]), self._result_tree()) 89 self.assertEquals(sorted(DEPENDENCIES[self.case()]), self._result_tree())
88 90
89 @staticmethod 91 @staticmethod
90 def _fix_file_mode(filename, read_only): 92 def _fix_file_mode(filename, read_only):
91 """4 modes are supported, 0755 (rwx), 0644 (rw), 0555 (rx), 0444 (r).""" 93 """4 modes are supported, 0755 (rwx), 0644 (rw), 0555 (rx), 0444 (r)."""
92 min_mode = 0444 94 min_mode = 0444
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return buf.getvalue() 439 return buf.getvalue()
438 440
439 def test_fail(self): 441 def test_fail(self):
440 try: 442 try:
441 self._execute('trace', 'fail.isolate', [], True) 443 self._execute('trace', 'fail.isolate', [], True)
442 self.fail() 444 self.fail()
443 except subprocess.CalledProcessError, e: 445 except subprocess.CalledProcessError, e:
444 out = e.output 446 out = e.output
445 self._expect_no_tree() 447 self._expect_no_tree()
446 self._expected_result(['fail.py'], None) 448 self._expected_result(['fail.py'], None)
447 expected = 'Failure: 1\nFailing\n\n' 449 # In theory, there should be 2 \n at the end of expected but for an
448 self.assertEquals(expected, out) 450 # unknown reason there's 3 \n on Windows so just rstrip() and compare the
451 # text, that's sufficient for this test.
452 expected = 'Failure: 1\nFailing'
453 self.assertEquals(expected, out.rstrip())
449 454
450 def test_missing_trailing_slash(self): 455 def test_missing_trailing_slash(self):
451 try: 456 try:
452 self._execute('trace', 'missing_trailing_slash.isolate', [], True) 457 self._execute('trace', 'missing_trailing_slash.isolate', [], True)
453 self.fail() 458 self.fail()
454 except subprocess.CalledProcessError, e: 459 except subprocess.CalledProcessError, e:
455 out = e.output 460 out = e.output
456 self._expect_no_tree() 461 self._expect_no_tree()
457 self._expect_no_result() 462 self._expect_no_result()
458 expected = 'Input directory %s must have a trailing slash\n' % os.path.join( 463 expected = 'Input directory %s must have a trailing slash\n' % os.path.join(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 ], 525 ],
521 } 526 }
522 self.assertEquals(self._to_string(expected), out) 527 self.assertEquals(self._to_string(expected), out)
523 528
524 529
525 530
526 if __name__ == '__main__': 531 if __name__ == '__main__':
527 VERBOSE = '-v' in sys.argv 532 VERBOSE = '-v' in sys.argv
528 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 533 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
529 unittest.main() 534 unittest.main()
OLDNEW
« no previous file with comments | « tools/isolate/isolate.py ('k') | tools/isolate/isolate_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698