Skip to content

Commit f6b9109

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Fixed littlefs tests to be Py3 compat
1 parent 397ee30 commit f6b9109

File tree

1 file changed

+12
-12
lines changed
  • features/storage/filesystem/littlefs/littlefs/tests

1 file changed

+12
-12
lines changed

features/storage/filesystem/littlefs/littlefs/tests/stats.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77
import re
88

99
def main():
10-
with open('blocks/config') as file:
10+
with open('blocks/config', 'rb') as file:
1111
s = struct.unpack('<LLLL', file.read())
12-
print 'read_size: %d' % s[0]
13-
print 'prog_size: %d' % s[1]
14-
print 'block_size: %d' % s[2]
15-
print 'block_size: %d' % s[3]
12+
print('read_size: %d' % s[0])
13+
print('prog_size: %d' % s[1])
14+
print('block_size: %d' % s[2])
15+
print('block_size: %d' % s[3])
1616

17-
print 'real_size: %d' % sum(
17+
print('real_size: %d' % sum(
1818
os.path.getsize(os.path.join('blocks', f))
19-
for f in os.listdir('blocks') if re.match('\d+', f))
19+
for f in os.listdir('blocks') if re.match('\d+', f)))
2020

21-
with open('blocks/stats') as file:
21+
with open('blocks/stats', 'rb') as file:
2222
s = struct.unpack('<QQQ', file.read())
23-
print 'read_count: %d' % s[0]
24-
print 'prog_count: %d' % s[1]
25-
print 'erase_count: %d' % s[2]
23+
print('read_count: %d' % s[0])
24+
print('prog_count: %d' % s[1])
25+
print('erase_count: %d' % s[2])
2626

27-
print 'runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime)
27+
print('runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime))
2828

2929
if __name__ == "__main__":
3030
main(*sys.argv[1:])

0 commit comments

Comments
 (0)