Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f42e007
Created initial implementation of revamped test.py
geky Dec 29, 2019
ed8341e
Reworked permutation generation in test framework and cleanup
geky Dec 30, 2019
53d2b02
Added reentrant and gdb testing mechanisms to test framework
geky Dec 31, 2019
eeaf536
Replaced emubd with rambd and filebd
geky Jan 3, 2020
1d2688a
Migrated test_files, test_dirs, test_format suites to new framework
geky Jan 11, 2020
b06ce54
Migrated the bulk of the feature-specific tests
geky Jan 13, 2020
5181ce6
Migrated the first of the tests with internal knowledge
geky Jan 14, 2020
ecc2857
Migrated bad-block tests
geky Jan 14, 2020
fb65057
Restructured block devices again for better test exploitation
geky Jan 16, 2020
9453ebd
Added/improved disk-reading debug scripts
geky Jan 19, 2020
f4b6a6b
Fixed issues with neighbor updates during moves
geky Jan 20, 2020
a5d614f
Added tests for power-cycled-relocations and fixed the bugs that fell…
geky Jan 22, 2020
b9d0695
Rewrote explode_asserts.py to be more efficient
geky Jan 25, 2020
52ef0c1
Fixed a crazy consistency issue in test.py
geky Jan 27, 2020
aab6aa0
Cleaned up test script and directory naming
geky Jan 27, 2020
517d341
Fixed more bugs, mostly related to ENOSPC on different geometries
geky Jan 29, 2020
77e3078
Added/fixed tests for noop writes (where bd error can't be trusted)
geky Jan 29, 2020
44d7112
Fixed tests/*.toml.* in .gitignore
geky Jan 29, 2020
f9c2fd9
Removed file outlining on ENOSPC in lfs_file_sync
geky Jan 30, 2020
6a55084
Modified readmdir/readtree to make reading non-truncated data easier
geky Jan 30, 2020
fe957de
Fixed broken wear-leveling when block_cycles = 2n-1
geky Feb 9, 2020
6530cb3
Fixed lfs_fs_size doubling metadata-pairs
geky Feb 9, 2020
02c84ac
Cleaned up dependent fixes on branch
geky Feb 9, 2020
b69cf89
Fixed CRC check when prog_size causes multiple CRCs per commit
geky Feb 10, 2020
9f546f1
Updated .travis.yml and added additional geometry constraints
geky Feb 10, 2020
f4b17b3
Added test.py support for tmpfs-backed disks
geky Feb 12, 2020
dcae185
Fixed typo in LFS_MKTAG_IF_ELSE
geky Feb 12, 2020
c7987a3
Restructured .travis.yml to span more jobs
geky Feb 16, 2020
d04b077
Fixed minor things to get CI passing again
geky Feb 17, 2020
0990296
Limited byte-level tests to native testing due to time
geky Feb 18, 2020
50fe8ae
Renamed test_format -> test_superblocks, tweaked superblock tests
geky Feb 19, 2020
a7dfae4
Minor tweaks to debugging scripts, fixed explode_asserts.py off-by-1
geky Feb 23, 2020
cb26157
Change assert to runtime check.
Dec 30, 2019
4677421
Added "evil" tests and detecion/recovery from bad pointers and infini…
geky Feb 24, 2020
d498b9f
(bugfix) adding line function to clear out all the global 'free' info…
Mar 24, 2020
5e5b5d8
(chore) updates from PR, we decided not to move forward with changing…
Mar 26, 2020
f17d3d7
Minor cleanup
Mar 26, 2020
f9dbec3
Added test case catching issues with errors during a lookahead scan
geky Mar 24, 2020
01e42ab
Merge pull request #401 from thrasher8390/bugfix/thrasher8390/issue-3…
geky Mar 29, 2020
ff84902
Moved out block device tracing into separate define
geky Mar 29, 2020
5137e4b
Last minute tweaks to debug scripts
geky Mar 30, 2020
6622f3d
Bumped minor version to v2.2
geky Mar 30, 2020
7257681
Merge branch 'master' into test-revamp
geky Mar 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modified readmdir/readtree to make reading non-truncated data easier
Added indention so there was a more clear separation between the tag
description and tag data.

Also took the best parts of readmdir.py and added it to readtree.py.
Initially I was thinking it was best for these to have completely
independent data representations, since you could always call readtree
to get more info, but this becomes tedius when needed to look at
low-level tag info across multiple directories on the filesystem.
  • Loading branch information
geky committed Feb 9, 2020
commit 6a550844f448f608c835d45df4656b972854a130
37 changes: 20 additions & 17 deletions scripts/readmdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import struct
import binascii
import sys
import itertools as it

TAG_TYPES = {
Expand Down Expand Up @@ -271,37 +272,39 @@ def __getitem__(self, args):

raise KeyError(gmask, gtag)

def _dump_tags(self, tags, truncate=True):
sys.stdout.write("%-8s %-8s %-13s %4s %4s %s\n" % (
'off', 'tag', 'type', 'id', 'len',
'data (truncated)' if truncate else 12*' '+'data'))
def _dump_tags(self, tags, f=sys.stdout, truncate=True):
f.write("%-8s %-8s %-13s %4s %4s" % (
'off', 'tag', 'type', 'id', 'len'))
if truncate:
f.write(' data (truncated)')
f.write('\n')

for tag in tags:
sys.stdout.write("%08x: %08x %-13s %4s %4s" % (
f.write("%08x: %08x %-13s %4s %4s" % (
tag.off, tag,
tag.typerepr(), tag.idrepr(), tag.sizerepr()))
if truncate:
sys.stdout.write(" %-23s %-8s\n" % (
f.write(" %-23s %-8s\n" % (
' '.join('%02x' % c for c in tag.data[:8]),
''.join(c if c >= ' ' and c <= '~' else '.'
for c in map(chr, tag.data[:8]))))
else:
sys.stdout.write("\n")
f.write("\n")
for i in range(0, len(tag.data), 16):
sys.stdout.write("%08x: %-47s %-16s\n" % (
f.write(" %08x: %-47s %-16s\n" % (
tag.off+i,
' '.join('%02x' % c for c in tag.data[i:i+16]),
''.join(c if c >= ' ' and c <= '~' else '.'
for c in map(chr, tag.data[i:i+16]))))

def dump_tags(self, truncate=True):
self._dump_tags(self.tags, truncate=truncate)
def dump_tags(self, f=sys.stdout, truncate=True):
self._dump_tags(self.tags, f=f, truncate=truncate)

def dump_log(self, truncate=True):
self._dump_tags(self.log, truncate=truncate)
def dump_log(self, f=sys.stdout, truncate=True):
self._dump_tags(self.log, f=f, truncate=truncate)

def dump_all(self, truncate=True):
self._dump_tags(self.all_, truncate=truncate)
def dump_all(self, f=sys.stdout, truncate=True):
self._dump_tags(self.all_, f=f, truncate=truncate)

def main(args):
blocks = []
Expand Down Expand Up @@ -337,10 +340,10 @@ def main(args):
help="First block address for finding the metadata pair.")
parser.add_argument('block2', nargs='?', type=lambda x: int(x, 0),
help="Second block address for finding the metadata pair.")
parser.add_argument('-a', '--all', action='store_true',
help="Show all tags in log, included tags in corrupted commits.")
parser.add_argument('-l', '--log', action='store_true',
help="Show tags in log.")
parser.add_argument('-a', '--all', action='store_true',
help="Show all tags in log, included tags in corrupted commits.")
parser.add_argument('-T', '--no-truncate', action='store_true',
help="Don't truncate large amounts of data in tags.")
help="Don't truncate large amounts of data.")
sys.exit(main(parser.parse_args()))
61 changes: 13 additions & 48 deletions scripts/readtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,6 @@ def popc(x):
def ctz(x):
return len(bin(x)) - len(bin(x).rstrip('0'))

def dumptags(args, mdir, f):
if args.all:
tags = mdir.all_
elif args.log:
tags = mdir.log
else:
tags = mdir.tags

for k, tag in enumerate(tags):
f.write("tag %08x %s" % (tag, tag.typerepr()))
if tag.id != 0x3ff:
f.write(" id %d" % tag.id)
if tag.size != 0x3ff:
f.write(" size %d" % tag.size)
if tag.is_('name'):
f.write(" name %s" %
json.dumps(tag.data.decode('utf8')))
if tag.is_('dirstruct'):
f.write(" dir {%#x, %#x}" % struct.unpack(
'<II', tag.data[:8].ljust(8, b'\xff')))
if tag.is_('ctzstruct'):
f.write(" ctz {%#x} size %d" % struct.unpack(
'<II', tag.data[:8].ljust(8, b'\xff')))
if tag.is_('inlinestruct'):
f.write(" inline size %d" % tag.size)
if tag.is_('gstate'):
f.write(" 0x%s" % ''.join('%02x' % c for c in tag.data))
if tag.is_('tail'):
f.write(" tail {%#x, %#x}" % struct.unpack(
'<II', tag.data[:8].ljust(8, b'\xff')))
f.write("\n")

if args.data:
for i in range(0, len(tag.data), 16):
f.write(" %-47s %-16s\n" % (
' '.join('%02x' % c for c in tag.data[i:i+16]),
''.join(c if c >= ' ' and c <= '~' else '.'
for c in map(chr, tag.data[i:i+16]))))

def dumpentries(args, mdir, f):
for k, id_ in enumerate(mdir.ids):
name = mdir[Tag('name', id_, 0)]
Expand All @@ -72,8 +33,8 @@ def dumpentries(args, mdir, f):

if args.data and struct_.is_('inlinestruct'):
for i in range(0, len(struct_.data), 16):
f.write(" %-47s %-16s\n" % (
' '.join('%02x' % c for c in struct_.data[i:i+16]),
f.write(" %08x: %-47s %-16s\n" % (
i, ' '.join('%02x' % c for c in struct_.data[i:i+16]),
''.join(c if c >= ' ' and c <= '~' else '.'
for c in map(chr, struct_.data[i:i+16]))))
elif args.data and struct_.is_('ctzstruct'):
Expand All @@ -95,8 +56,8 @@ def dumpentries(args, mdir, f):
it.chain.from_iterable(reversed(data)), size))
for i in range(0, min(len(data), 256)
if not args.no_truncate else len(data), 16):
f.write(" %-47s %-16s\n" % (
' '.join('%02x' % c for c in data[i:i+16]),
f.write(" %08x: %-47s %-16s\n" % (
i, ' '.join('%02x' % c for c in data[i:i+16]),
''.join(c if c >= ' ' and c <= '~' else '.'
for c in map(chr, data[i:i+16]))))

Expand Down Expand Up @@ -239,8 +200,12 @@ def main(args):
' (corrupted)' if not mdir else ''))

f = io.StringIO()
if args.tags or args.all or args.log:
dumptags(args, mdir, f)
if args.tags:
mdir.dump_tags(f, truncate=not args.no_truncate)
elif args.log:
mdir.dump_log(f, truncate=not args.no_truncate)
elif args.all:
mdir.dump_all(f, truncate=not args.no_truncate)
else:
dumpentries(args, mdir, f)

Expand Down Expand Up @@ -285,12 +250,12 @@ def main(args):
help="Show contents of metadata-pairs/directories.")
parser.add_argument('-t', '--tags', action='store_true',
help="Show metadata tags instead of reconstructing entries.")
parser.add_argument('-a', '--all', action='store_true',
help="Show all tags in log, included tags in corrupted commits.")
parser.add_argument('-l', '--log', action='store_true',
help="Show tags in log.")
parser.add_argument('-a', '--all', action='store_true',
help="Show all tags in log, included tags in corrupted commits.")
parser.add_argument('-d', '--data', action='store_true',
help="Also show the raw contents of files/attrs/tags.")
parser.add_argument('-T', '--no-truncate', action='store_true',
help="Don't truncate large amounts of data in files.")
help="Don't truncate large amounts of data.")
sys.exit(main(parser.parse_args()))