[rhmessaging-commits] rhmessaging commits: r1602 - store/trunk/cpp/tests/jrnl/jtt.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu Jan 24 13:34:12 EST 2008
Author: kpvdr
Date: 2008-01-24 13:34:12 -0500 (Thu, 24 Jan 2008)
New Revision: 1602
Modified:
store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
jfile_chk.py now displays hex rather than string when msg data and xid are non alphanumeric
Modified: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-01-24 16:58:17 UTC (rev 1601)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-01-24 18:34:12 UTC (rev 1602)
@@ -81,10 +81,10 @@
if xidsize > 0:
raise Exception('Inconsistent XID size: xidsize=%d, xid=None' % xidsize)
return ''
- if len(xid) > 25:
- xidstr = xid[:10] + ' ... ' + xid[-10:]
+ if xid.isalnum():
+ xidstr = split_str(xid)
else:
- xidstr = xid
+ xidstr = hex_split_str(xid)
if xidsize != len(xid):
raise Exception('Inconsistent XID size: xidsize=%d, xid(%d)=\"%s\"' % (xidsize, len(xid), xidstr))
return 'xid(%d)=\"%s\" ' % (xidsize, xidstr)
@@ -92,14 +92,33 @@
def print_data(dsize, data):
if data == None:
return ''
- if len(data) > 25:
- datastr = data[:10] + ' ... ' + data[-10:]
+ if data.isalnum():
+ datastr = split_str(data)
else:
- datastr = data
+ datastr = hex_split_str(data)
if dsize != len(data):
raise Exception('Inconsistent data size: dsize=%d, data(%d)=\"%s\"' % (dsize, len(data), datastr))
return 'data(%d)=\"%s\" ' % (dsize, datastr)
+def hex_split_str(s):
+ hex_str = ''
+ if len(s) > 10:
+ for i in range(0, 5):
+ hex_str += '%02x ' % ord(s[i])
+ hex_str += '... '
+ for i in range(len(s)-5, len(s)):
+ hex_str += '%02x ' % ord(s[i])
+ else:
+ for i in range(0, len(s)):
+ hex_str += '%02x ' % ord(s[i])
+ return hex_str
+
+def split_str(s):
+ if len(s) > 25:
+ return s[:10] + ' ... ' + s[-10:]
+ else:
+ return s
+
def inv_str(s):
si = ''
for i in range(0,len(s)):
@@ -174,7 +193,7 @@
if self.magic[-1] == 'x':
return '0x%08x: \"%s\"' % (self.foffs, self.magic)
if self.magic[-1] in ['a', 'c', 'd', 'e', 'f', 'x']:
- return '0x%08x: \"%s\" v=%d e=%d f=0x%04x rid=%d' % (self.foffs, self.magic, self.ver, self.end, self.flags, self.rid)
+ return '0x%08x: \"%s\" v=%d e=%d f=0x%04x rid=0x%x' % (self.foffs, self.magic, self.ver, self.end, self.flags, self.rid)
return '0x%08x: <error, unknown magic \"%s\" (possible overwrite boundary?)>' % (self.foffs, self.magic)
def empty(self):
@@ -319,7 +338,7 @@
def __str__(self):
magic = inv_str(self.magic_inv)
- return '[\"%s\" rid=%d]' % (magic, self.rid)
+ return '[\"%s\" rid=0x%x]' % (magic, self.rid)
def skip(self, f):
f.read(rem_in_blk(f, dblk_size))
More information about the rhmessaging-commits
mailing list