Skip Menu |
 

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

Report information
The Basics
Id: 110326
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/module.t fails with three errors ( due to non-existent /sys/ nodes )

not ok 9 - open with undefined name # TODO will fail in future

#   Failed (TODO) test 'open with undefined name'
#   at t/module.t line 72.

ok 10 - An object of class 'Linux::Sysfs::Module' isa 'Linux::Sysfs::Module'
not ok 11 - undef isa 'Linux::Sysfs::Attribute'

#   Failed test 'undef isa 'Linux::Sysfs::Attribute''
#   at t/module.t line 82.
#     undef isn't defined

ok 20 - An object of class 'Linux::Sysfs::Module' isa 'Linux::Sysfs::Module'
not ok 21 - get_sections

#   Failed test 'get_sections'
#   at t/module.t line 145.


ok 30 - An object of class 'Linux::Sysfs::Module' isa 'Linux::Sysfs::Module'
not ok 31 - undef isa 'Linux::Sysfs::Attribute'

#   Failed test 'undef isa 'Linux::Sysfs::Attribute''
#   at t/module.t line 204.
#     undef isn't defined

---

t/module.t line 82

    my $module = Linux::Sysfs::Module->open_path($val_mod_path);
    isa_ok( $module, 'Linux::Sysfs::Module' );

    my $attr = $module->get_attr($val_mod_attr_name);
    isa_ok( $attr, 'Linux::Sysfs::Attribute' ); #TODO: errno

 

$val_mod_path is "/sys/module/vt"
$val_mod_attr_name is "refcnt"
 

But there is no child of sys/module/vt by that name, so $attr is undef.


ls -FRah /sys/module/vt/
/sys/module/vt/:
./  ../  parameters/  uevent

/sys/module/vt/parameters:
./   color        default_blu  default_red   global_cursor_default  underline
../  cur_default  default_grn  default_utf8  italic


Though lots of other modules have refcnts

ls -FRah /sys/module/*/refcnt
/sys/module/binfmt_misc/refcnt     /sys/module/snd_hda_codec/refcnt          /sys/module/snd_timer/refcnt
/sys/module/cfg80211/refcnt        /sys/module/snd_hda_codec_generic/refcnt  /sys/module/uas/refcnt
/sys/module/intel_rapl/refcnt      /sys/module/snd_hda_codec_realtek/refcnt  /sys/module/usb_storage/refcnt
/sys/module/iosf_mbi/refcnt        /sys/module/snd_hda_core/refcnt           /sys/module/xhci_hcd/refcnt
/sys/module/nvidia/refcnt          /sys/module/snd_hda_intel/refcnt          /sys/module/xhci_pci/refcnt
/sys/module/nvidia_modeset/refcnt  /sys/module/snd_hwdep/refcnt              /sys/module/zram/refcnt
/sys/module/sch_fq_codel/refcnt    /sys/module/snd_pcm/refcnt

---

t/module.t line 145

$val_mod_path is "/sys/module/vt".
 
    my $module = Linux::Sysfs::Module->open_path($val_mod_path);
    isa_ok( $module, 'Linux::Sysfs::Module' );

    my @sects = $module->get_sections;
    ok( scalar @sects > 0, 'get_sections' );


"/sys/module/vt" doesn't have any children called "sections" ( See earlier dump ), but other modules do:

echo /sys/module/*/sections | tr " " "\n"
/sys/module/binfmt_misc/sections
/sys/module/cfg80211/sections
/sys/module/intel_rapl/sections
/sys/module/iosf_mbi/sections
/sys/module/nvidia/sections
/sys/module/nvidia_modeset/sections
/sys/module/sch_fq_codel/sections
/sys/module/snd_hda_codec/sections
/sys/module/snd_hda_codec_generic/sections
/sys/module/snd_hda_codec_realtek/sections
/sys/module/snd_hda_core/sections
/sys/module/snd_hda_intel/sections
/sys/module/snd_hwdep/sections
/sys/module/snd_pcm/sections
/sys/module/snd_timer/sections
/sys/module/uas/sections
/sys/module/usb_storage/sections
/sys/module/xhci_hcd/sections
/sys/module/xhci_pci/sections
/sys/module/zram/sections

---

#   at t/module.t line 204.

  my $module = Linux::Sysfs::Module->open_path($val_mod_path);
    isa_ok( $module, 'Linux::Sysfs::Module' );

    my $sect = $module->get_section($val_mod_section);
    isa_ok( $sect, 'Linux::Sysfs::Attribute' ); #TODO: errno

This looks like the same issue with the previous error, $val_mod_path is of course the vt dir without sections.

$val_mod_section is "__versions", and literally no modules have that.

 find /sys/module/ | grep __versions # no output

And as luck would have it, both "refcnt" and "__version" are values hardcoded in 01-config.t and not autodiscovered =)

All non-todoised issues mentioned here are easily fixable by me adjusting 01-config.t


@39

-$fh->print("    val_mod_section => '__version',\n");

+$fh->print("    val_mod_section => '" . find_section_name() . "',\n");

@212

-    return (find_device_paths($path, sub { -d $_ && -d "$_/parameters" }))[0];
+    return (find_device_paths($path, sub { -d $_ && -d "$_/parameters" && -d "$_/sections" }))[0];

@229

+sub find_section_name {
+    my $path = find_mod_path();
+    $path .= '/sections';
+    return (find_device_paths($path, sub { -f $_ && -r $_ }))[0]->[1];
+}



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.