Subject: bug#29030: closed (Re: [bug#29030] [PATCH] perl-sys-cpu: Mark cpu_type and cpu_clock tests as TODO.)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 29 Oct 2017 04:30:02 +0000

Your bug report

#29030: [PATCH] perl-sys-cpu: Mark cpu_type and cpu_clock tests as TODO.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
29030: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29030
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#29030] [PATCH] perl-sys-cpu: Mark cpu_type and cpu_clock tests as TODO.
From: Eric Bavier <[email-masked]>
To: [email-masked] (Ludovic Courtès)
Cc: [email-masked]
Date: Sat, 28 Oct 2017 18:29:07 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

On Sat, 28 Oct 2017 09:51:24 +0200
[email-masked] (Ludovic Courtès) wrote:

> Hi Eric,
> 
> Eric Bavier <[email-masked]> skribis:
> 
> > On my system, perl-sys-cpu's tests fail because of differences in the information available in /proc/cpuinfo.
> >
> > Debian's patch for this perl module seemed nice: rather than trying to fix the related functions, just concede that the module is mostly used just to read the number of available processors and mark the other tests as "TODO".  
> 
> [...]
> 
> > +              (snippet
> > +               '(begin
> > +                  ;; Replace test with one that marks cpu_clock and cpu_type
> > +                  ;; as TODO.  Borrowed from Debian.  
> 
> Perhaps make it clear in the comment that we do this because the
> contents of /proc/cpuinfo differ based on different factors.

OK.

> Otherwise LGTM, thanks!

Thanks, pushed in 9de52b56438674c0d0f92be34cebf5f1a38a6bfa.

`~Eric

Subject: [PATCH] perl-sys-cpu: Mark cpu_type and cpu_clock tests as TODO.
From: Eric Bavier <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Fri, 27 Oct 2017 20:40:12 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello Guix,

On my system, perl-sys-cpu's tests fail because of differences in the information available in /proc/cpuinfo.

Debian's patch for this perl module seemed nice: rather than trying to fix the related functions, just concede that the module is mostly used just to read the number of available processors and mark the other tests as "TODO".

This patch replaces the test file with debian's using an origin snippet.

Eric Bavier, Scientific Libraries, Cray Inc.
diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index 815a212..7d1fda7 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2013 Andreas Enge <[email-masked]>
 ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <[email-masked]>
-;;; Copyright © 2015, 2016 Eric Bavier <[email-masked]>
+;;; Copyright © 2015, 2016, 2017 Eric Bavier <[email-masked]>
 ;;; Copyright © 2015 Eric Dvorsak <[email-masked]>
 ;;; Copyright © 2016 Mark H Weaver <[email-masked]>
 ;;; Copyright © 2016 Jochem Raat <[email-masked]>
@@ -6665,7 +6665,34 @@ statements: @code{switch} and @code{case}.")
                                   "Sys-CPU-" version ".tar.gz"))
               (sha256
                (base32
-                "1r6976bs86j7zp51m5vh42xlyah951jgdlkimv202413kjvqc2i5"))))
+                "1r6976bs86j7zp51m5vh42xlyah951jgdlkimv202413kjvqc2i5"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Replace test with one that marks cpu_clock and cpu_type
+                  ;; as TODO.  Borrowed from Debian.
+                  (call-with-output-file "t/Sys-CPU.t"
+                    (lambda (port)
+                      (format port "#!/usr/bin/perl
+
+use Test::More tests => 4;
+
+BEGIN { use_ok('Sys::CPU'); }
+
+$number = &Sys::CPU::cpu_count();
+ok( defined($number), \"CPU Count: $number\" );
+
+TODO: {
+    local $TODO = \"/proc/cpuinfo doesn't always report 'cpu MHz' or 'clock' or 'bogomips' ...\";
+    $speed = &Sys::CPU::cpu_clock();
+    ok( defined($speed), \"CPU Speed: $speed\" );
+}
+
+TODO: {
+    local $TODO = \"/proc/cpuinfo doesn't always report 'model name' or 'machine' ...\";
+    $type = &Sys::CPU::cpu_type();
+    ok( defined($type), \"CPU Type:  $type\" );
+}~%")))))))
     (build-system perl-build-system)
     (synopsis "Perl extension for getting CPU information")
     (description