Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2017-03-26 01:02:16 +0300
committerChristopher Haster <chaster@utexas.edu>2017-03-26 03:23:30 +0300
commitafa4ad82544048581913e0a273745acb3886dc84 (patch)
treed4222c078fd9c90e18e9d0d1b801f7846262de54 /tests/stats.py
parent84a57642e53616e1b9f8050e58dd21eecf168184 (diff)
Added a rudimentary test framework
Tests can be found in 'tests/test_blah.sh' Tests can be run with 'make test'
Diffstat (limited to 'tests/stats.py')
-rwxr-xr-xtests/stats.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/stats.py b/tests/stats.py
new file mode 100755
index 0000000..9508e79
--- /dev/null
+++ b/tests/stats.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+import struct
+import sys
+import time
+import os
+import re
+
+def main():
+ with open('blocks/info') as file:
+ s = struct.unpack('<LLL4xQ', file.read())
+ print 'read_size: %d' % s[0]
+ print 'prog_size: %d' % s[1]
+ print 'erase_size: %d' % s[2]
+ print 'total_size: %d' % s[3]
+
+ print 'real_size: %d' % sum(
+ os.path.getsize(os.path.join('blocks', f))
+ for f in os.listdir('blocks') if re.match('\d+', f))
+
+ print 'runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime)
+
+ with open('blocks/stats') 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]
+
+if __name__ == "__main__":
+ main(*sys.argv[1:])