diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2017-10-02 17:59:12 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2017-10-02 17:59:12 +0000 |
commit | a807660918ec33d05c39fb20fffeab84775cfcbc (patch) | |
tree | 59bdb9b6cca79fc479d5524ed03245827b73e78c /clang/utils/analyzer/SATestUpdateDiffs.py | |
parent | f21a60233c8089ec47c0685db657df9f75188701 (diff) | |
download | bcm5719-llvm-a807660918ec33d05c39fb20fffeab84775cfcbc.tar.gz bcm5719-llvm-a807660918ec33d05c39fb20fffeab84775cfcbc.zip |
[Analyzer] Make testing scripts flake8 compliant
Differential Review: https://reviews.llvm.org/D38213
llvm-svn: 314692
Diffstat (limited to 'clang/utils/analyzer/SATestUpdateDiffs.py')
-rwxr-xr-x | clang/utils/analyzer/SATestUpdateDiffs.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/clang/utils/analyzer/SATestUpdateDiffs.py b/clang/utils/analyzer/SATestUpdateDiffs.py index df836b10f84..9b5b7064ce0 100755 --- a/clang/utils/analyzer/SATestUpdateDiffs.py +++ b/clang/utils/analyzer/SATestUpdateDiffs.py @@ -11,18 +11,23 @@ import os import sys Verbose = 1 + + def runCmd(Command): if Verbose: print "Executing %s" % Command check_call(Command, shell=True) + def updateReferenceResults(ProjName, ProjBuildMode): ProjDir = SATestBuild.getProjectDir(ProjName) - RefResultsPath = os.path.join(ProjDir, - SATestBuild.getSBOutputDirName(IsReferenceBuild=True)) - CreatedResultsPath = os.path.join(ProjDir, - SATestBuild.getSBOutputDirName(IsReferenceBuild=False)) + RefResultsPath = os.path.join( + ProjDir, + SATestBuild.getSBOutputDirName(IsReferenceBuild=True)) + CreatedResultsPath = os.path.join( + ProjDir, + SATestBuild.getSBOutputDirName(IsReferenceBuild=False)) if not os.path.exists(CreatedResultsPath): print >> sys.stderr, "New results not found, was SATestBuild.py "\ @@ -36,29 +41,34 @@ def updateReferenceResults(ProjName, ProjBuildMode): runCmd('cp -r "%s" "%s"' % (CreatedResultsPath, RefResultsPath,)) # Run cleanup script. - with open(SATestBuild.getBuildLogPath(RefResultsPath), "wb+") as PBuildLogFile: + BuildLogPath = SATestBuild.getBuildLogPath(RefResultsPath) + with open(BuildLogPath, "wb+") as PBuildLogFile: SATestBuild.runCleanupScript(ProjDir, PBuildLogFile) - SATestBuild.normalizeReferenceResults(ProjDir, RefResultsPath, ProjBuildMode) + SATestBuild.normalizeReferenceResults( + ProjDir, RefResultsPath, ProjBuildMode) # Clean up the generated difference results. SATestBuild.cleanupReferenceResults(RefResultsPath) # Remove the created .diffs file before adding. - runCmd('rm -f "%s/*/%s"' % (RefResultsPath, SATestBuild.DiffsSummaryFileName)) + runCmd('rm -f "%s/*/%s"' % ( + RefResultsPath, SATestBuild.DiffsSummaryFileName)) runCmd('git add "%s"' % (RefResultsPath,)) + def main(argv): if len(argv) == 2 and argv[1] in ('-h', '--help'): print >> sys.stderr, "Update static analyzer reference results based "\ "\non the previous run of SATestBuild.py.\n"\ - "\nN.B.: Assumes that SATestBuild.py was just run." + "\nN.B.: Assumes that SATestBuild.py was just run" sys.exit(-1) with SATestBuild.projectFileHandler() as f: for (ProjName, ProjBuildMode) in SATestBuild.iterateOverProjects(f): updateReferenceResults(ProjName, int(ProjBuildMode)) + if __name__ == '__main__': main(sys.argv) |