Fixed littlefs tests to be Py3 compat

pull/9844/head
Cruz Monrreal II 2019-03-20 16:45:11 -05:00
parent 397ee3074a
commit f6b9109934
1 changed files with 12 additions and 12 deletions

View File

@ -7,24 +7,24 @@ import os
import re
def main():
with open('blocks/config') as file:
with open('blocks/config', 'rb') as file:
s = struct.unpack('<LLLL', file.read())
print 'read_size: %d' % s[0]
print 'prog_size: %d' % s[1]
print 'block_size: %d' % s[2]
print 'block_size: %d' % s[3]
print('read_size: %d' % s[0])
print('prog_size: %d' % s[1])
print('block_size: %d' % s[2])
print('block_size: %d' % s[3])
print 'real_size: %d' % sum(
print('real_size: %d' % sum(
os.path.getsize(os.path.join('blocks', f))
for f in os.listdir('blocks') if re.match('\d+', f))
for f in os.listdir('blocks') if re.match('\d+', f)))
with open('blocks/stats') as file:
with open('blocks/stats', 'rb') as file:
s = struct.unpack('<QQQ', file.read())
print 'read_count: %d' % s[0]
print 'prog_count: %d' % s[1]
print 'erase_count: %d' % s[2]
print('read_count: %d' % s[0])
print('prog_count: %d' % s[1])
print('erase_count: %d' % s[2])
print 'runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime)
print('runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime))
if __name__ == "__main__":
main(*sys.argv[1:])