def addNewProject(ID, BuildMode): CurDir = os.path.abspath(os.curdir) Dir = SATestBuild.getProjectDir(ID) if not os.path.exists(Dir): print "Error: Project directory is missing: %s" % Dir sys.exit(-1) # Build the project. SATestBuild.testProject(ID, BuildMode, IsReferenceBuild=True, Dir=Dir) # Add the project ID to the project map. ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile) if os.path.exists(ProjectMapPath): PMapFile = open(ProjectMapPath, "r+b") else: print "Warning: Creating the Project Map file!!" PMapFile = open(ProjectMapPath, "w+b") try: if (isExistingProject(PMapFile, ID)): print >> sys.stdout, 'Warning: Project with ID \'', ID, \ '\' already exists.' print >> sys.stdout, "Reference output has been regenerated." else: PMapWriter = csv.writer(PMapFile) PMapWriter.writerow((ID, int(BuildMode))) print "The project map is updated: ", ProjectMapPath finally: PMapFile.close()
def addNewProject(ID, BuildMode) : CurDir = os.path.abspath(os.curdir) Dir = SATestBuild.getProjectDir(ID) if not os.path.exists(Dir): print "Error: Project directory is missing: %s" % Dir sys.exit(-1) # Build the project. SATestBuild.testProject(ID, BuildMode, IsReferenceBuild=True, Dir=Dir) # Add the project ID to the project map. ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile) if os.path.exists(ProjectMapPath): PMapFile = open(ProjectMapPath, "r+b") else: print "Warning: Creating the Project Map file!!" PMapFile = open(ProjectMapPath, "w+b") try: if (isExistingProject(PMapFile, ID)) : print >> sys.stdout, 'Warning: Project with ID \'', ID, \ '\' already exists.' print >> sys.stdout, "Reference output has been regenerated." else: PMapWriter = csv.writer(PMapFile) PMapWriter.writerow( (ID, int(BuildMode)) ); print "The project map is updated: ", ProjectMapPath finally: PMapFile.close()
def addNewProject(ID, BuildMode): """ Add a new project for testing: build it and add to the Project Map file. :param ID: is a short string used to identify a project. """ CurDir = os.path.abspath(os.curdir) Dir = SATestBuild.getProjectDir(ID) if not os.path.exists(Dir): print "Error: Project directory is missing: %s" % Dir sys.exit(-1) # Build the project. SATestBuild.testProject(ID, BuildMode, IsReferenceBuild=True) # Add the project ID to the project map. ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile) if os.path.exists(ProjectMapPath): FileMode = "r+b" else: print "Warning: Creating the Project Map file!!" FileMode = "w+b" with open(ProjectMapPath, FileMode) as PMapFile: if (isExistingProject(PMapFile, ID)): print >> sys.stdout, 'Warning: Project with ID \'', ID, \ '\' already exists.' print >> sys.stdout, "Reference output has been regenerated." else: PMapWriter = csv.writer(PMapFile) PMapWriter.writerow((ID, int(BuildMode))) print "The project map is updated: ", ProjectMapPath
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)) if not os.path.exists(CreatedResultsPath): print >> sys.stderr, "New results not found, was SATestBuild.py "\ "previously run?" sys.exit(-1) # Remove reference results. runCmd('git rm -r "%s"' % (RefResultsPath,)) # Replace reference results with a freshly computed once. runCmd('cp -r "%s" "%s"' % (CreatedResultsPath, RefResultsPath,)) # Run cleanup script. with open(SATestBuild.getBuildLogPath(RefResultsPath), "wb+") as PBuildLogFile: SATestBuild.runCleanupScript(ProjDir, PBuildLogFile) 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('git add "%s"' % (RefResultsPath,))
def addNewProject(ID): CurDir = os.path.abspath(os.curdir) Dir = SATestBuild.getProjectDir(ID) if not os.path.exists(Dir): print "Error: Project directory is missing: %s" % Dir sys.exit(-1) # Build the project. SATestBuild.testProject(ID, True, Dir) # Add the project ID to the project map. ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile) if os.path.exists(ProjectMapPath): PMapFile = open(ProjectMapPath, "r+b") else: print "Warning: Creating the Project Map file!!" PMapFile = open(ProjectMapPath, "w+b") try: PMapReader = csv.reader(PMapFile) for I in PMapReader: IID = I[0] if ID == IID: print >> sys.stderr, 'Warning: Project with ID \'', ID, \ '\' already exists.' sys.exit(-1) PMapWriter = csv.writer(PMapFile) PMapWriter.writerow((ID, Dir)) finally: PMapFile.close() print "The project map is updated: ", ProjectMapPath
def addNewProject(ID): CurDir = os.path.abspath(os.curdir) Dir = SATestBuild.getProjectDir(ID) if not os.path.exists(Dir): print "Error: Project directory is missing: %s" % Dir sys.exit(-1) # Build the project. SATestBuild.testProject(ID, True, Dir) # Add the project ID to the project map. ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile) if os.path.exists(ProjectMapPath): PMapFile = open(ProjectMapPath, "r+b") else: print "Warning: Creating the Project Map file!!" PMapFile = open(ProjectMapPath, "w+b") try: PMapReader = csv.reader(PMapFile) for I in PMapReader: IID = I[0] if ID == IID: print >> sys.stderr, "Warning: Project with ID '", ID, "' already exists." sys.exit(-1) PMapWriter = csv.writer(PMapFile) PMapWriter.writerow((ID, Dir)) finally: PMapFile.close() print "The project map is updated: ", ProjectMapPath
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)) if not os.path.exists(CreatedResultsPath): print("New results not found, was SATestBuild.py " "previously run?", file=sys.stderr) sys.exit(1) BuildLogPath = SATestBuild.getBuildLogPath(RefResultsPath) Dirname = os.path.dirname(os.path.abspath(BuildLogPath)) runCmd("mkdir -p '%s'" % Dirname) with open(BuildLogPath, "w+") as PBuildLogFile: # Remove reference results: in git, and then again for a good measure # with rm, as git might not remove things fully if there are empty # directories involved. runCmd('git rm -r -q "%s"' % (RefResultsPath, ), stdout=PBuildLogFile) runCmd('rm -rf "%s"' % (RefResultsPath, ), stdout=PBuildLogFile) # Replace reference results with a freshly computed once. runCmd('cp -r "%s" "%s"' % ( CreatedResultsPath, RefResultsPath, ), stdout=PBuildLogFile) # Run cleanup script. SATestBuild.runCleanupScript(ProjDir, PBuildLogFile) SATestBuild.normalizeReferenceResults(ProjDir, RefResultsPath, ProjBuildMode) # Clean up the generated difference results. SATestBuild.cleanupReferenceResults(RefResultsPath) runCmd('git add "%s"' % (RefResultsPath, ), stdout=PBuildLogFile)
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)) if not os.path.exists(CreatedResultsPath): print >> sys.stderr, "New results not found, was SATestBuild.py "\ "previously run?" sys.exit(-1) # Remove reference results: in git, and then again for a good measure # with rm, as git might not remove things fully if there are empty # directories involved. runCmd('git rm -r -q "%s"' % (RefResultsPath, )) runCmd('rm -rf "%s"' % (RefResultsPath, )) # Replace reference results with a freshly computed once. runCmd('cp -r "%s" "%s"' % ( CreatedResultsPath, RefResultsPath, )) # Run cleanup script. BuildLogPath = SATestBuild.getBuildLogPath(RefResultsPath) with open(BuildLogPath, "wb+") as PBuildLogFile: SATestBuild.runCleanupScript(ProjDir, PBuildLogFile) SATestBuild.normalizeReferenceResults(ProjDir, RefResultsPath, ProjBuildMode) # Clean up the generated difference results. SATestBuild.cleanupReferenceResults(RefResultsPath) # Remove the created .diffs file before adding. removeDiffsSummaryFiles(RefResultsPath) runCmd('git add "%s"' % (RefResultsPath, ))
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)) if not os.path.exists(CreatedResultsPath): print >> sys.stderr, "New results not found, was SATestBuild.py "\ "previously run?" sys.exit(-1) # Remove reference results: in git, and then again for a good measure # with rm, as git might not remove things fully if there are empty # directories involved. runCmd('git rm -r -q "%s"' % (RefResultsPath,)) runCmd('rm -rf "%s"' % (RefResultsPath,)) # Replace reference results with a freshly computed once. runCmd('cp -r "%s" "%s"' % (CreatedResultsPath, RefResultsPath,)) # Run cleanup script. BuildLogPath = SATestBuild.getBuildLogPath(RefResultsPath) with open(BuildLogPath, "wb+") as PBuildLogFile: SATestBuild.runCleanupScript(ProjDir, PBuildLogFile) SATestBuild.normalizeReferenceResults( ProjDir, RefResultsPath, ProjBuildMode) # Clean up the generated difference results. SATestBuild.cleanupReferenceResults(RefResultsPath) # Remove the created .diffs file before adding. removeDiffsSummaryFiles(RefResultsPath) runCmd('git add "%s"' % (RefResultsPath,))
def addNewProject(ID, BuildMode): """ Add a new project for testing: build it and add to the Project Map file. :param ID: is a short string used to identify a project. """ CurDir = os.path.abspath(os.curdir) Dir = SATestBuild.getProjectDir(ID) if not os.path.exists(Dir): print("Error: Project directory is missing: %s" % Dir) sys.exit(-1) # Build the project. # TODO: Repair this call. We give it a wrong amount wrong arguments and it # is not trivial to construct argparse arguments in here. # Requires refactoring of the 'testProject' function. SATestBuild.testProject(ID, BuildMode, IsReferenceBuild=True) # Add the project ID to the project map. ProjectMapPath = os.path.join(CurDir, SATestBuild.ProjectMapFile) if os.path.exists(ProjectMapPath): FileMode = "r+" else: print("Warning: Creating the Project Map file!!") FileMode = "w+" with open(ProjectMapPath, FileMode) as PMapFile: if (isExistingProject(PMapFile, ID)): print('Warning: Project with ID \'', ID, '\' already exists.', file=sys.stdout) print("Reference output has been regenerated.", file=sys.stdout) else: PMapWriter = csv.writer(PMapFile) PMapWriter.writerow((ID, int(BuildMode))) print("The project map is updated: ", ProjectMapPath)