Пример #1
0
 def getSourceInfo(self)->SourceInfo:
     libsrcinfo = _UcdbSourceInfo()
     sourceinfo_p = byref(libsrcinfo)
     
     get_lib().ucdb_GetScopeSourceInfo(self.db, self.obj, sourceinfo_p)
     
     return UcdbSourceInfo.ctor(self.db, libsrcinfo)
Пример #2
0
    def __next__(self):
        self.next = get_lib().ucis_HistoryScan(self.db, self.next)

        if next is None:
            raise StopIteration

        return UcdbHistoryNode(self.db, self.next)
Пример #3
0
 def createInstance(self,
                 name : str,
                 fileinfo : SourceInfo,
                 weight : int,
                 source : SourceT,
                 type : ScopeTypeT,
                 du_scope : Scope,
                 flags : FlagsT):
     fileinfo_p = None if fileinfo is None else byref(_UcdbSourceInfo.ctor(fileinfo))
     sh = get_lib().ucdb_CreateInstance(
         self.db,
         self.obj,
         str.encode(name),
         fileinfo_p,
         weight,
         source,
         type,
         du_scope.obj,
         flags)
     
     if sh is None:
         print("Error: ucdb_CreateInstance failed: du=" + str(du_scope) + " du.obj=" + str(du_scope.obj))
         raise Exception("ucdb_CreateInstance failed")
     
     return UcdbScope(self.db, sh)
Пример #4
0
 def createScope(self, 
     name:str, 
     srcinfo:SourceInfo, 
     weight:int, 
     source, 
     type, 
     flags):
     srcinfo_p = None if srcinfo is None else byref(_UcdbSourceInfo.ctor(srcinfo))
     print("createScope: db=" + str(self.db) + " obj=" + str(self.obj) + 
           " name=" + str(name) + " srcinfo_p=" + str(srcinfo_p) +
           " weight=" + str(weight) + "source=" + hex(source) + " type=" + hex(type) + " flags=" + hex(flags));
     sh = get_lib().ucdb_CreateScope(
         self.db,
         self.obj,
         None if name is None else str.encode(name),
         srcinfo_p,
         weight,
         source,
         type,
         flags)
     
     if sh is None:
         print("Error: createScope failed: parent=" + str(self.obj))
         raise Exception("Failed to create scope")
     
     return UcdbScope(self.db, sh)
Пример #5
0
    def __init__(self, file: str = None, db=None):
        if db is None:
            db = get_lib().ucis_OpenV(
                str.encode(file) if file is not None else None,
                (20 * 10000 * 100) + (19 * 10000) + 49)

            if db is None:
                if file is not None:
                    raise Exception("Error: failed to open UCIS file \"" +
                                    file + "\"")
                else:
                    raise Exception("Error: failed to create UCIS DB")
        super().__init__(db, None)
Пример #6
0
 def createNextCover(self,
                     name : str,
                     data : CoverData,
                     sourceinfo : SourceInfo) -> int:
     sourceinfo_p = None if sourceinfo is None else byref(_UcdbSourceInfo.ctor(sourceinfo))
     data_p = byref(UcdbCoverData.ctor(data))
     
     index =  get_lib().ucdb_CreateNextCover(
         self.db,
         self.obj,
         str.encode(name),
         data_p,
         sourceinfo_p)
     
     return UcdbCoverIndex(self.db, self.obj, index)
Пример #7
0
 def createToggle(self,
                 name : str,
                 canonical_name : str,
                 flags : FlagsT,
                 toggle_metric : ToggleMetricT,
                 toggle_type : ToggleTypeT,
                 toggle_dir : ToggleDirT) -> 'Scope':
     th = get_lib().ucdb_CreateToggle(
         self.db,
         self.obj,
         str.encode(name),
         None if canonical_name is None else str.encode(canonical_name),
         flags,
         toggle_metric,
         toggle_type,
         toggle_dir)
     return UcdbScope(self.db, th)
Пример #8
0
 def createCovergroup(self, 
     name:str, 
     srcinfo:SourceInfo, 
     weight:int, 
     source) -> 'Covergroup':
     from ucis.ucdb.ucdb_covergroup import UcdbCovergroup
     
     srcinfo_p = None if srcinfo is None else pointer(_UcdbSourceInfo.ctor(srcinfo))
     cg_obj = get_lib().ucdb_CreateScope(
         self.db,
         self.obj,
         str.encode(name),
         srcinfo_p,
         weight,
         source,
         UCIS_COVERGROUP,
         0)
     
     return UcdbCovergroup(self.db, cg_obj)
Пример #9
0
 def getNumTests(self):
     return get_lib().ucis_GetIntProperty(self.db, -1,
                                          IntProperty.NUM_TESTS)
Пример #10
0
 def modifiedSinceSim(self):
     return get_lib().ucis_GetIntProperty(
         self.db, -1, IntProperty.MODIFIED_SINCE_SIM) == 1
Пример #11
0
 def isModified(self):
     return get_lib().ucis_GetIntProperty(self.db, -1,
                                          IntProperty.IS_MODIFIED) == 1
Пример #12
0
    def getTestData(self):
        ucdb_td = pointer(UcdbTestData())

        get_lib().ucis_SetTestData(self.db, self.obj, ucdb_td)

        return ucdb_td.to_testdata()
Пример #13
0
 def write(self, file, scope=None, recurse=True, covertype=-1):
     print("file=" + file)
     ret = get_lib().ucis_Write(self.db, str.encode(file), scope,
                                1 if recurse else 0, covertype)
     print("ret=" + str(ret))
Пример #14
0
 def getFileName(self) -> str:
     raise NotImplementedError()
     return get_lib().ucis_GetFileName(self.db, self.fh)
Пример #15
0
    def createFileHandle(self, filename, workdir) -> FileHandle:
        fh = get_lib().ucis_CreateFileHandle(
            self.db, str.encode(filename),
            None if workdir is None else str.encode(workdir))

        return UcdbFileHandle(self.db, fh)
Пример #16
0
 def setStringProperty(self, coverindex: int, property: StrProperty,
                       value: str):
     obj = self.db if self.obj is None else self.obj
     get_lib().ucis_SetStringProperty(self.db, obj, coverindex, property,
                                      str.encode(value))
Пример #17
0
 def createHistoryNode(self, parent, logicalname, physicalname,
                       kind) -> 'HistoryNode':
     hn = get_lib().ucis_CreateHistoryNode(self.db, parent,
                                           str.encode(logicalname),
                                           str.encode(physicalname), kind)
     return UcdbHistoryNode(self.db, hn)
Пример #18
0
 def __init__(self, db, hist_obj, kind):
     self.db = db
     self.next = get_lib().ucdb_NextHistoryNode(self.db, None, kind)
Пример #19
0
 def close(self):
     ret = get_lib().ucis_Close(self.db)
     print("close ret=" + str(ret))
Пример #20
0
    def setTestData(self, testdata: TestData):
        ucdb_td = pointer(UcdbTestData.ctor(testdata))

        get_lib().ucis_SetTestData(self.db, self.obj, ucdb_td)