| OLD | NEW |
| 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 """Reads a .isolated, creates a tree of hardlinks and runs the test. | 6 """Reads a .isolated, creates a tree of hardlinks and runs the test. |
| 7 | 7 |
| 8 Keeps a local cache. | 8 Keeps a local cache. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 else: | 1769 else: |
| 1770 shutil.copyfile(no_cache.path(obj), outfile) | 1770 shutil.copyfile(no_cache.path(obj), outfile) |
| 1771 | 1771 |
| 1772 if 'm' in properties and not sys.platform == 'win32': | 1772 if 'm' in properties and not sys.platform == 'win32': |
| 1773 # It's not set on Windows. It could be set only in the case of | 1773 # It's not set on Windows. It could be set only in the case of |
| 1774 # downloading content generated from another OS. Do not crash in that | 1774 # downloading content generated from another OS. Do not crash in that |
| 1775 # case. | 1775 # case. |
| 1776 os.chmod(outfile, properties['m']) | 1776 os.chmod(outfile, properties['m']) |
| 1777 | 1777 |
| 1778 if time.time() - last_update > DELAY_BETWEEN_UPDATES_IN_SECS: | 1778 if time.time() - last_update > DELAY_BETWEEN_UPDATES_IN_SECS: |
| 1779 logging.info('%d files remaining...' % len(remaining)) | 1779 msg = '%d files remaining...' % len(remaining) |
| 1780 print msg |
| 1781 logging.info(msg) |
| 1780 last_update = time.time() | 1782 last_update = time.time() |
| 1781 | 1783 |
| 1782 print('.isolated files successfully downloaded and setup in %s' % | 1784 print('.isolated files successfully downloaded and setup in %s' % |
| 1783 target_directory) | 1785 target_directory) |
| 1784 print('To run this test please run the command %s from the directory %s' % | 1786 print('To run this test please run the command %s from the directory %s' % |
| 1785 (cmd, cwd)) | 1787 (cmd, cwd)) |
| 1786 | 1788 |
| 1787 return 0 | 1789 return 0 |
| 1788 | 1790 |
| 1789 | 1791 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 while remaining: | 1827 while remaining: |
| 1826 obj = cache.wait_for(remaining) | 1828 obj = cache.wait_for(remaining) |
| 1827 for filepath, properties in remaining.pop(obj): | 1829 for filepath, properties in remaining.pop(obj): |
| 1828 outfile = os.path.join(outdir, filepath) | 1830 outfile = os.path.join(outdir, filepath) |
| 1829 link_file(outfile, cache.path(obj), HARDLINK) | 1831 link_file(outfile, cache.path(obj), HARDLINK) |
| 1830 if 'm' in properties: | 1832 if 'm' in properties: |
| 1831 # It's not set on Windows. | 1833 # It's not set on Windows. |
| 1832 os.chmod(outfile, properties['m']) | 1834 os.chmod(outfile, properties['m']) |
| 1833 | 1835 |
| 1834 if time.time() - last_update > DELAY_BETWEEN_UPDATES_IN_SECS: | 1836 if time.time() - last_update > DELAY_BETWEEN_UPDATES_IN_SECS: |
| 1835 logging.info('%d files remaining...' % len(remaining)) | 1837 msg = '%d files remaining...' % len(remaining) |
| 1838 print msg |
| 1839 logging.info(msg) |
| 1836 last_update = time.time() | 1840 last_update = time.time() |
| 1837 | 1841 |
| 1838 if settings.read_only: | 1842 if settings.read_only: |
| 1839 make_writable(outdir, True) | 1843 make_writable(outdir, True) |
| 1840 logging.info('Running %s, cwd=%s' % (cmd, cwd)) | 1844 logging.info('Running %s, cwd=%s' % (cmd, cwd)) |
| 1841 | 1845 |
| 1842 # TODO(csharp): This should be specified somewhere else. | 1846 # TODO(csharp): This should be specified somewhere else. |
| 1843 # Add a rotating log file if one doesn't already exist. | 1847 # Add a rotating log file if one doesn't already exist. |
| 1844 env = os.environ.copy() | 1848 env = os.environ.copy() |
| 1845 env.setdefault('RUN_TEST_CASES_LOG_FILE', RUN_TEST_CASES_LOG) | 1849 env.setdefault('RUN_TEST_CASES_LOG_FILE', RUN_TEST_CASES_LOG) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 except Exception, e: | 1958 except Exception, e: |
| 1955 # Make sure any exception is logged. | 1959 # Make sure any exception is logged. |
| 1956 logging.exception(e) | 1960 logging.exception(e) |
| 1957 return 1 | 1961 return 1 |
| 1958 | 1962 |
| 1959 | 1963 |
| 1960 if __name__ == '__main__': | 1964 if __name__ == '__main__': |
| 1961 # Ensure that we are always running with the correct encoding. | 1965 # Ensure that we are always running with the correct encoding. |
| 1962 fix_default_encoding() | 1966 fix_default_encoding() |
| 1963 sys.exit(main()) | 1967 sys.exit(main()) |
| OLD | NEW |