Skip to content

Commit

Permalink
edd: Log every glob.glob() match in our test data log.
Browse files Browse the repository at this point in the history
This way we can be sure we collect them for test cases.

Signed-off-by: Peter Jones <pjones@redhat.com>
  • Loading branch information
vathpela committed Nov 6, 2015
1 parent 0d86a7c commit f45df72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
13 changes: 0 additions & 13 deletions blivet/devicelibs/edd.py
Expand Up @@ -358,9 +358,7 @@ def __init__(self, edd_entry, root=None):

def devname_from_ata_pci_dev(self):
pattern = util.Path('/sys/block/*', root=self.root)
testdata_log.debug("sysfs glob: %s", pattern)
for path in pattern.glob():
testdata_log.debug("sysfs glob match: %s", path)
emptyslash = util.Path("/", root=self.root)
path = util.Path(path, root=self.root)
link = util.sysfs_readlink(path=emptyslash, link=path)
Expand Down Expand Up @@ -426,9 +424,7 @@ def devname_from_ata_pci_dev(self):
dev = util.join_paths(fn + ['dev%d.*' % (ata_port_idx,)])
dev = util.Path(dev, root=self.root)
for ataglob in [pmp, dev]:
testdata_log.debug("sysfs glob: %s", ataglob)
for atapath in ataglob.glob():
testdata_log.debug("sysfs glob match: %s", atapath)
match = expmatcher.match(atapath.ondisk)
if match is None:
continue
Expand Down Expand Up @@ -469,10 +465,7 @@ def devname_from_scsi_pci_dev(self):
}
path = util.Path(tmpl0 % args, root=self.root)
pattern = util.Path(tmpl1 % args, root=self.root)
testdata_log.debug("sysfs glob: %s", pattern)
matching_paths = list(pattern.glob())
for mp in matching_paths:
testdata_log.debug("sysfs glob match: %s", mp)
if os.path.isdir(path.ondisk):
block_entries = os.listdir(path.ondisk)
if len(block_entries) == 1:
Expand Down Expand Up @@ -505,11 +498,7 @@ def devname_from_scsi_pci_dev(self):
def devname_from_virt_pci_dev(self):
pattern = util.Path("/sys/devices/pci0000:00/0000:%s/virtio*" %
(self.edd.pci_dev,), root=self.root)
testdata_log.debug("sysfs glob: %s", pattern)
matching_paths = tuple(pattern.glob())
for mp in matching_paths:
testdata_log.debug("sysfs glob match: %s", mp)

if len(matching_paths) == 1 and os.path.exists(matching_paths[0]):
# Normal VirtIO devices just have the block link right there...
newpath = util.Path(matching_paths[0], root=self.root) + "/block"
Expand Down Expand Up @@ -571,9 +560,7 @@ def match_via_mbrsigs(self, mbr_dict):
def collect_edd_data(root=None):
edd_data_dict = {}
globstr = util.Path("/sys/firmware/edd/int13_dev*/", root=root)
testdata_log.debug("sysfs glob: %s", globstr)
for path in globstr.glob():
testdata_log.debug("sysfs glob match: %s", path)
match = re_bios_device_number.match(path)
biosdev = int("0x%s" % (match.group(1),), base=16)
log.debug("edd: found device 0x%x at %s", biosdev, path)
Expand Down
8 changes: 7 additions & 1 deletion blivet/util.py
Expand Up @@ -137,8 +137,14 @@ def glob(self):
account when globbing and returns path objects with the same
root, so you don't have to think about that part.
"""

testdata_log.debug("glob: %s", self.ondisk)
if "None" in self.ondisk:
log.error("glob: %s", self.ondisk)
log.error("^^ Somehow \"None\" got logged and that's never right.")
for g in glob.glob(self.ondisk):
yield Path(g, root=self.root)
testdata_log.debug("glob match: %s", g)
yield Path(g, self.root)

def __hash__(self):
return self._path.__hash__()
Expand Down

0 comments on commit f45df72

Please sign in to comment.