diff options
author | nsylvain@google.com <nsylvain@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-14 18:12:00 +0000 |
---|---|---|
committer | nsylvain@google.com <nsylvain@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-14 18:12:00 +0000 |
commit | 2306db495868fbfafe68ab69a7a1089993be9081 (patch) | |
tree | fba5f9addfd2c1d30af79118282545e34b98d8d1 | |
parent | 96c09dee476cb1c44f0f39781ccc01879a9dd48a (diff) | |
download | chromium_src-2306db495868fbfafe68ab69a7a1089993be9081.zip chromium_src-2306db495868fbfafe68ab69a7a1089993be9081.tar.gz chromium_src-2306db495868fbfafe68ab69a7a1089993be9081.tar.bz2 |
Handle the case where a shard crashed and did not generate an xml file.
TBR=maruel
Review URL: https://chromiumcodereview.appspot.com/10084032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132343 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/sharding_supervisor/sharding_supervisor.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/sharding_supervisor/sharding_supervisor.py b/tools/sharding_supervisor/sharding_supervisor.py index 035950e..4ed9580 100755 --- a/tools/sharding_supervisor/sharding_supervisor.py +++ b/tools/sharding_supervisor/sharding_supervisor.py @@ -103,8 +103,13 @@ def AppendToXML(final_xml, generic_path, shard): """Combine the shard xml file with the final xml file.""" path = generic_path + str(shard) - with open(path) as shard_xml_file: - shard_xml = minidom.parse(shard_xml_file) + + try: + with open(path) as shard_xml_file: + shard_xml = minidom.parse(shard_xml_file) + except IOError: + # If the shard crashed, gtest will not have generated an xml file. + return final_xml if not final_xml: # Out final xml is empty, let's prepopulate it with the first one we see. @@ -369,8 +374,10 @@ class ShardingSupervisor(object): final_xml = None for i in range(start_point, start_point + self.num_shards_to_run): final_xml = AppendToXML(final_xml, xml_path, i) - with open(xml_path, 'w') as final_file: - final_xml.writexml(final_file) + + if final_xml: + with open(xml_path, 'w') as final_file: + final_xml.writexml(final_file) num_failed = len(self.failed_shards) if num_failed > 0: |