Skip to content

Commit

Permalink
[analyzer] SATestBuild.py: Be defensive against corrupt plist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
haoNoQ committed May 13, 2020
1 parent e16111c commit 8cbd3f4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions clang/utils/analyzer/SATestBuild.py
Expand Up @@ -58,6 +58,7 @@
import sys
import threading
import time
from xml.parsers.expat import ExpatError
try:
import queue
except ImportError:
Expand Down Expand Up @@ -485,10 +486,14 @@ def CleanUpEmptyPlists(SBOutputDir):
for F in glob.glob(SBOutputDir + "/*/*.plist"):
P = os.path.join(SBOutputDir, F)

Data = plistlib.readPlist(P)
# Delete empty reports.
if not Data['files']:
os.remove(P)
try:
Data = plistlib.readPlist(P)
# Delete empty reports.
if not Data['files']:
os.remove(P)
continue
except ExpatError as e:
print('Error parsing plist file %s: %s' % (P, str(e)))
continue


Expand Down

0 comments on commit 8cbd3f4

Please sign in to comment.