OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
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 disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 result = None | 499 result = None |
500 err_str = None | 500 err_str = None |
501 try: | 501 try: |
502 exit_code = self._executive.run_command(comand, return_exit_code=Tru
e) | 502 exit_code = self._executive.run_command(comand, return_exit_code=Tru
e) |
503 if exit_code == 0: | 503 if exit_code == 0: |
504 # The images are the same. | 504 # The images are the same. |
505 result = None | 505 result = None |
506 elif exit_code == 1: | 506 elif exit_code == 1: |
507 result = self._filesystem.read_binary_file(native_diff_filename) | 507 result = self._filesystem.read_binary_file(native_diff_filename) |
508 else: | 508 else: |
509 err_str = "image diff returned an exit code of %s" % exit_code | 509 err_str = "Image diff returned an exit code of %s. See http://cr
bug.com/278596" % exit_code |
510 except OSError, e: | 510 except OSError, e: |
511 err_str = 'error running image diff: %s' % str(e) | 511 err_str = 'error running image diff: %s' % str(e) |
512 finally: | 512 finally: |
513 self._filesystem.rmtree(str(tempdir)) | 513 self._filesystem.rmtree(str(tempdir)) |
514 | 514 |
515 return (result, err_str or None) | 515 return (result, err_str or None) |
516 | 516 |
517 def diff_text(self, expected_text, actual_text, expected_filename, actual_fi
lename): | 517 def diff_text(self, expected_text, actual_text, expected_filename, actual_fi
lename): |
518 """Returns a string containing the diff of the two text strings | 518 """Returns a string containing the diff of the two text strings |
519 in 'unified diff' format.""" | 519 in 'unified diff' format.""" |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 if name.find('/') != -1: | 1753 if name.find('/') != -1: |
1754 _log.error("Virtual test suites names cannot contain /'s: %s" %
name) | 1754 _log.error("Virtual test suites names cannot contain /'s: %s" %
name) |
1755 return | 1755 return |
1756 self.name = 'virtual/' + name + '/' + base | 1756 self.name = 'virtual/' + name + '/' + base |
1757 self.base = base | 1757 self.base = base |
1758 self.args = args | 1758 self.args = args |
1759 self.tests = tests or set() | 1759 self.tests = tests or set() |
1760 | 1760 |
1761 def __repr__(self): | 1761 def __repr__(self): |
1762 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self.
args) | 1762 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self.
args) |
OLD | NEW |