parameters: (self, ctype)
docstring: Read file just written and compare to ihex file
docstring_summary: Read file just written and compare to ihex file
docstring_tokens: Read file just written and compare to ihex file
function: def validate(self, ctype):
          """ Read file just written and compare to ihex file """
          self.ofile.close()
          with open(self.ofile.name, "rb") as ipmifile:
              filecontent = ipmifile.read()
  
          contents = struct.unpack('B' * len(filecontent), filecontent)
          if ctype == 'bmc_app':
              for index_ in range(len(self.jump_bl_instrs)):
                  c_value = contents[index_+self.BW_BL_HDR_SIZE]
                  j_value = self.jump_bl_instrs[index_]
                  if c_value != j_value:
                      print("addr %x diff: file=%x, const=%x" %
                            (index_, c_value, j_value))
  
              start_ = self.BW_BL_HDR_SIZE + self.BW_BL_PAGE_SIZE
          else:
              start_ = 0
  
          for block_ in range(start_, len(filecontent)-1,
                              self.BW_BL_HDR_SIZE + self.BW_BL_PAGE_SIZE):
              addr_ = contents[block_+10] + (contents[block_+11] << 8) + \
                  (contents[block_+12] << 16) + (contents[block_+13] << 24)
              len_ = contents[block_+14] + (contents[block_+15] << 8)
  
              for index_ in range(len_):
                  if self.ihex[addr_+index_] != contents[block_+index_+16]:
                      print("addr %x diff: ihex=%x, ipmi=%x" %
                            (addr_+index_, self.ihex[addr_+index_],
                             contents[block_+index_+16]))
function_tokens: def validate ( self , ctype ) : self . ofile . close ( ) with open ( self . ofile . name , "rb" ) as ipmifile : filecontent = ipmifile . read ( ) contents = struct . unpack ( 'B' * len ( filecontent ) , filecontent ) if ctype == 'bmc_app' : for index_ in range ( len ( self . jump_bl_instrs ) ) : c_value = contents [ index_ + self . BW_BL_HDR_SIZE ] j_value = self . jump_bl_instrs [ index_ ] if c_value != j_value : print ( "addr %x diff: file=%x, const=%x" % ( index_ , c_value , j_value ) ) start_ = self . BW_BL_HDR_SIZE + self . BW_BL_PAGE_SIZE else : start_ = 0 for block_ in range ( start_ , len ( filecontent ) - 1 , self . BW_BL_HDR_SIZE + self . BW_BL_PAGE_SIZE ) : addr_ = contents [ block_ + 10 ] + ( contents [ block_ + 11 ] << 8 ) + ( contents [ block_ + 12 ] << 16 ) + ( contents [ block_ + 13 ] << 24 ) len_ = contents [ block_ + 14 ] + ( contents [ block_ + 15 ] << 8 ) for index_ in range ( len_ ) : if self . ihex [ addr_ + index_ ] != contents [ block_ + index_ + 16 ] : print ( "addr %x diff: ihex=%x, ipmi=%x" % ( addr_ + index_ , self . ihex [ addr_ + index_ ] , contents [ block_ + index_ + 16 ] ) )