Skip Menu |

This queue is for tickets about the Linux-Sysfs CPAN distribution.

Report information
The Basics
Id: 110321
Status: new
Priority: 0/
Queue: Linux-Sysfs

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.03
Fixed in: (no value)



Subject: t/class_device.t fails tests for `get_device`, returns `undef`

This block of code from line 85 of class_device.t fails:

---

# get_device
{
    my $classdev = Linux::Sysfs::ClassDevice->open($val_class, $val_class_dev);
    isa_ok( $classdev, 'Linux::Sysfs::ClassDevice' );

    my $dev = $classdev->get_device;
    isa_ok( $dev, 'Linux::Sysfs::Device' ); #TODO: errno

    show_device($dev);
    $classdev->close;
}
---

 

It appears to be being called with $val_class = "net" and "$val_class_dev" = "lo"

But $classdev->get_device returns "undef";

I'm guessing this is because there is no device listed at "/sys/class/net/lo/device" while I imagine it may have at some point existed.

 

However, for me "/sys/class/net/eth0/device" exists, and locally forcing "$val_class" to be "eth0" is enough to make this test pass.

 

I suspect you can get around this simply by changing the config rule in 01-config.t

@140
-     return (find_device_paths($path, sub { -d $_  }))[0]->[1];
+    return (find_device_paths($path, sub { -d $_ && -d "$_/device" }))[0]->[1];