OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # coding=utf-8 | 2 # coding=utf-8 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Runs strace or dtrace on a test and processes the logs to extract the | 7 """Runs strace or dtrace on a test and processes the logs to extract the |
8 dependencies from the source tree. | 8 dependencies from the source tree. |
9 | 9 |
10 Automatically extracts directories where all the files are used to make the | 10 Automatically extracts directories where all the files are used to make the |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 assert mapped not in self._MAPPING | 127 assert mapped not in self._MAPPING |
128 if mapped not in self._MAPPING: | 128 if mapped not in self._MAPPING: |
129 self._MAPPING[mapped] = letter | 129 self._MAPPING[mapped] = letter |
130 except WindowsError: # pylint: disable=E0602 | 130 except WindowsError: # pylint: disable=E0602 |
131 pass | 131 pass |
132 | 132 |
133 def to_dos(self, path): | 133 def to_dos(self, path): |
134 """Converts a native NT path to DOS path.""" | 134 """Converts a native NT path to DOS path.""" |
135 m = re.match(r'(^\\Device\\[a-zA-Z0-9]+)(\\.*)?$', path) | 135 m = re.match(r'(^\\Device\\[a-zA-Z0-9]+)(\\.*)?$', path) |
136 assert m, path | 136 assert m, path |
137 assert m.group(1) in self._MAPPING, (path, self._MAPPING) | 137 if not m.group(1) in self._MAPPING: |
| 138 # Unmapped partitions may be accessed by windows for the |
| 139 # fun of it while the test is running. Discard these. |
| 140 return None |
138 drive = self._MAPPING[m.group(1)] | 141 drive = self._MAPPING[m.group(1)] |
139 if not drive or not m.group(2): | 142 if not drive or not m.group(2): |
140 return drive | 143 return drive |
141 return drive + m.group(2) | 144 return drive + m.group(2) |
142 | 145 |
143 | 146 |
144 def get_native_path_case(root, relative_path): | 147 def get_native_path_case(root, relative_path): |
145 """Returns the native path case.""" | 148 """Returns the native path case.""" |
146 if sys.platform == 'win32': | 149 if sys.platform == 'win32': |
147 # Windows used to have an option to turn on case sensitivity on non Win32 | 150 # Windows used to have an option to turn on case sensitivity on non Win32 |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 'New child: %d -> %d %s' % (ppid, pid, line[self.PROC_NAME])) | 953 'New child: %d -> %d %s' % (ppid, pid, line[self.PROC_NAME])) |
951 | 954 |
952 def handle_SystemConfig_Any(self, line): | 955 def handle_SystemConfig_Any(self, line): |
953 pass | 956 pass |
954 | 957 |
955 def _handle_file(self, filename): | 958 def _handle_file(self, filename): |
956 """Handles a file that was touched. | 959 """Handles a file that was touched. |
957 | 960 |
958 Interestingly enough, the file is always with an absolute path. | 961 Interestingly enough, the file is always with an absolute path. |
959 """ | 962 """ |
960 if (self.blacklist(filename) or | 963 if (not filename or |
| 964 self.blacklist(filename) or |
961 os.path.isdir(filename) or | 965 os.path.isdir(filename) or |
962 filename in self.files or | 966 filename in self.files or |
963 filename in self.non_existent): | 967 filename in self.non_existent): |
964 return | 968 return |
965 logging.debug('_handle_file(%s)' % filename) | 969 logging.debug('_handle_file(%s)' % filename) |
966 if os.path.isfile(filename): | 970 if os.path.isfile(filename): |
967 self.files.add(filename) | 971 self.files.add(filename) |
968 else: | 972 else: |
969 self.non_existent.add(filename) | 973 self.non_existent.add(filename) |
970 | 974 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 os.path.abspath(options.log), | 1440 os.path.abspath(options.log), |
1437 args, | 1441 args, |
1438 options.root_dir, | 1442 options.root_dir, |
1439 options.cwd, | 1443 options.cwd, |
1440 options.product_dir, | 1444 options.product_dir, |
1441 options.force) | 1445 options.force) |
1442 | 1446 |
1443 | 1447 |
1444 if __name__ == '__main__': | 1448 if __name__ == '__main__': |
1445 sys.exit(main()) | 1449 sys.exit(main()) |
OLD | NEW |