Re: proposed fixes for #14674, HP-UX, and legacy Solaris in facter processorcount

88 views
Skip to first unread message

Alex Harvey

unread,
Sep 10, 2012, 10:13:00 PM9/10/12
to puppe...@googlegroups.com
Sorry, typo in that - should read "We have found that facter's processorcount & processorN code breaks on ... all versions of Solaris prior to *Solaris 8*."

Andy Parker

unread,
Sep 11, 2012, 12:06:33 PM9/11/12
to puppe...@googlegroups.com
On Mon, Sep 10, 2012 at 7:06 PM, Alex Harvey <alexh...@gmail.com> wrote:
> Hi all,
>
> I am new to Ruby, Puppet & this project so bear with me if I am on the wrong
> track.
>

Welcome and thanks for helping out.

> I am in the process of deploying Puppet to a large fleet of HP-UX versions
> 11.00, 11.11, 11.23 and 11.31 as well as Solaris versions 2.5, 2.6, 7, 8 & 9
> (as well as plenty of AIX & RHEL/CentOS that isn't relevant to this post).
>
> We have found that facter's processorcount & processorN code breaks on HP-UX
> (where HP-UX doesn't appear to be supported) and also on all versions of
> Solaris prior to Solaris 10. This relates to Bug #14674.
>
> I am proposing the following changes to 1.6.x to fix the code per
> suggestions from Josh Cooper as well as providing patches for the versions
> of HP-UX and legacy Solaris we can test on.
>
> * I would begin by refactoring util/processor.rb a little moving iterative
> code to the top, all Facter.add blocks after this, and standardise naming of
> 'ProcessorCount' using camel case. I would do this in a single commit?
>

I would do that in two commits. Partly because as much as
standardizing the naming would be good, it might have to get dropped
so as to not break uses of it. Smaller, targeted commits are usually
better than larger ones.

> * I understand Josh Cooper's suggestion "It should only call these methods
> on the appropriate platform, and it should only call them when needed (if
> processor_list is empty)" (from http://projects.puppetlabs.com/issues/14674)
> thus have rewritten
>
> ## We have to enumerate these outside a Facter.add block to get the
> processorN descriptions iteratively
> ## (but we need them inside the Facter.add block above for tests on
> processorcount to work)
> processor_list = Facter::Util::Processor.enum_cpuinfo
> processor_list_aix = Facter::Util::Processor.enum_lsdev
> processor_list_sunos = Facter::Util::Processor.enum_kstat
>
> if processor_list.length != 0
> etc
>
> as
>
> ## We have to enumerate these outside a Facter.add block to get the
> processorN descriptions iteratively
> ## (but we need them inside the Facter.add block above for tests on
> processorcount to work)
> if Facter.value(:kernel) == "AIX"
> processor_list = Facter::Util::Processor.enum_lsdev
> elsif Facter.value(:kernel) == "SunOS"
> processor_list = Facter::Util::Processor.enum_kstat
> else
> processor_list = Facter::Util::Processor.enum_cpuinfo
> end
>
> if processor_list.length != 0
> processor_list.each_with_index do |desc, i|
> Facter.add("Processor#{i}") do
> confine :kernel => [ :linux, :"gnu/kfreebsd", :aix, :sunos ]
> setcode do
> desc
> end
> end
> end
> end
>

I don't think you need to preserve those `if processor_list.length`
checks. Just call the `each_with_index` and if the list is empty
nothing will happen.

> * Having done that I would then open bugs for the failures I get in HP-UX
> and legacy Solaris. I documented the HP-UX problem in an update to #14674
> and feel it might be reasonable to fix HP-UX under the same bug? Thus I
> would in a single commit add a case for HP-UX -
>

I would open another bug or find something that already exists to
track adding the HP-UX facts. #11612 seems like it might be closely
related.

> elsif Facter.value(:kernel) == "HP-UX"
> processor_list = Facter::Util::Processor.enum_machinfo
> ...
>
> and provide the method enum_machinfo in util/processor.rb to get CPU
> information on HP-UX.
>
> * Then I will open a bug for legacy Solaris. The problem with legacy
> Solaris is that 'kstat cpu_info' was not introduced until Solaris 8; on
> Solaris 7 and earlier this code fails. I'll work out a solution to this
> problem prior to raising the bug.
>
> I have read the documentation about how to contribute, and so forth, so will
> follow that. Otherwise, do I sound like I am on the right track?
>

I think it sounds like you have a good handle on things. As you submit
stuff the conversation will continue, of course. :)

> Kind regards,
> Alex Harvey
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-dev/-/xQsajJ6FTccJ.
> To post to this group, send email to puppe...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-dev+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.

Alex Harvey

unread,
Sep 12, 2012, 1:25:50 AM9/12/12
to puppe...@googlegroups.com


On Wednesday, September 12, 2012 2:06:37 AM UTC+10, Andy Parker wrote:

Welcome and thanks for helping out.

Thanks!
 
> * I would begin by refactoring util/processor.rb a little moving iterative
> code to the top, all Facter.add blocks after this, and standardise naming of
> 'ProcessorCount' using camel case.  I would do this in a single commit?
>

I would do that in two commits. Partly because as much as
standardizing the naming would be good, it might have to get dropped
so as to not break uses of it. Smaller, targeted commits are usually
better than larger ones.

Okay, I assume the case doesn't actually matter because processor.rb has examples of both.  Which is preferred - lower case or camel case?
 
> if processor_list.length != 0
>   processor_list.each_with_index do |desc, i|
>     Facter.add("Processor#{i}") do
>       confine :kernel => [ :linux, :"gnu/kfreebsd", :aix, :sunos ]
>       setcode do
>         desc
>       end
>     end
>   end
> end

I don't think you need to preserve those `if processor_list.length`
checks. Just call the `each_with_index` and if the list is empty
nothing will happen.

I see, noted.
 
I would open another bug or find something that already exists to
track adding the HP-UX facts. #11612 seems like it might be closely
related.

Yes, you are absolutely right; I didn't see that.  That makes it a bit more complicated.  I have looked through the code in https://github.com/puppetlabs/facter/pull/232 now and I could use much of that code and extend it to PA-RISC and the versions of HP-UX I have.  It has status "tests insufficient" and no one is assigned, though.  It seems more sensible that I continue working with that branch - is that possible?  Can I somehow be assigned to the issue, assuming no one is working on it?

Andy Parker

unread,
Sep 12, 2012, 12:49:51 PM9/12/12
to puppe...@googlegroups.com
On Tue, Sep 11, 2012 at 10:25 PM, Alex Harvey <alexh...@gmail.com> wrote:

>>
>> I would do that in two commits. Partly because as much as
>> standardizing the naming would be good, it might have to get dropped
>> so as to not break uses of it. Smaller, targeted commits are usually
>> better than larger ones.
>
>
> Okay, I assume the case doesn't actually matter because processor.rb has
> examples of both. Which is preferred - lower case or camel case?
>

You're right that casing doesn't matter. I thought that you were
talking about changing the name of the fact on openBSD where it seems
to be known as Processor instead of ProcessorCount.

>>
>> I would open another bug or find something that already exists to
>> track adding the HP-UX facts. #11612 seems like it might be closely
>> related.
>
>
> Yes, you are absolutely right; I didn't see that. That makes it a bit more
> complicated. I have looked through the code in
> https://github.com/puppetlabs/facter/pull/232 now and I could use much of
> that code and extend it to PA-RISC and the versions of HP-UX I have. It has
> status "tests insufficient" and no one is assigned, though. It seems more
> sensible that I continue working with that branch - is that possible? Can I
> somehow be assigned to the issue, assuming no one is working on it?
>

If it looks like nobody has continued working on it go ahead and
continue with that as a starting point. You can assign the bug to
yourself, I think. If not I can assign it to you.

> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-dev/-/cOuDF8BK_DoJ.

Alex Harvey

unread,
Sep 13, 2012, 9:31:49 AM9/13/12
to puppe...@googlegroups.com
So I have made my change and am trying to run the tests. 

Trouble is some of the tests are failing - as well as me getting a whole range of warnings - even before I make my change.  After making my change, I get the same result, suggesting I haven't broken anything.

I suspect I am doing something wrong. :)

About my platform -

myhostfacter]# ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [sparc-solaris2.10]
myhost[facter]# gem list

*** LOCAL GEMS ***

diff-lcs (1.1.3)
facter (1.6.7)
metaclass (0.0.1)
minitest (3.4.0)
mocha (0.12.4)
puppet (2.7.6)
rake (0.9.2.2)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
rspec-mocks (2.11.2)

And the test results -

myhost[facter]# find spec/ -name "*.rb" |while read s; do echo $s; rspec $s; done
spec/puppetlabs_spec/verbose.rb
No examples found.


Finished in 0.0001 seconds
0 examples, 0 failures
spec/puppetlabs_spec/fixtures.rb
/var/tmp/facter/spec/puppetlabs_spec/fixtures.rb:4: uninitialized constant PuppetlabsSpec (NameError)
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
        from /usr/local/bin/rspec:23
spec/puppetlabs_spec/files.rb
/var/tmp/facter/spec/puppetlabs_spec/files.rb:6: uninitialized constant PuppetlabsSpec (NameError)
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
        from /usr/local/bin/rspec:23
spec/puppetlabs_spec/matchers.rb
/var/tmp/facter/spec/puppetlabs_spec/matchers.rb:8:in `alias_method': undefined method `should' for module `RSpec::Matchers::BlockAliases' (NameError)
        from /var/tmp/facter/spec/puppetlabs_spec/matchers.rb:8
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
        from /usr/local/bin/rspec:23
spec/puppetlabs_spec_helper.rb
/var/tmp/facter/spec/puppetlabs_spec/matchers.rb:8:in `alias_method': undefined method `should' for module `RSpec::Matchers::BlockAliases' (NameError)
        from /var/tmp/facter/spec/puppetlabs_spec/matchers.rb:8
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /var/tmp/facter/spec/puppetlabs_spec_helper.rb:13
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
        from /usr/local/bin/rspec:23
spec/integration/facter_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..

Finished in 0.00386 seconds
2 examples, 0 failures
spec/spec_helper.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
No examples found.


Finished in 0.00008 seconds
0 examples, 0 failures
spec/watchr.rb
/var/tmp/facter/spec/watchr.rb:92: undefined method `watch' for main:Object (NoMethodError)
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
        from /usr/local/bin/rspec:23
spec/shared_contexts/platform.rb
No examples found.


Finished in 0.0001 seconds
0 examples, 0 failures
spec/fixtures/unit/util/loader/nosuchfact.rb
/var/tmp/facter/spec/fixtures/unit/util/loader/nosuchfact.rb:1: uninitialized constant Facter (NameError)
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
        from /usr/local/lib/ruby/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `autorun'
        from /usr/local/bin/rspec:23
spec/unit/lsbrelease_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.01652 seconds
4 examples, 0 failures
spec/unit/hostname_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.0223 seconds
4 examples, 0 failures
spec/unit/uniqueid_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
...

Finished in 0.01112 seconds
3 examples, 0 failures
spec/unit/util/virtual_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.............................

Finished in 0.06929 seconds
29 examples, 0 failures
spec/unit/util/registry_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
No examples found.


Finished in 0.00008 seconds
0 examples, 0 failures
spec/unit/util/collection_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....................................

Finished in 0.05451 seconds
36 examples, 0 failures
spec/unit/util/wmi_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..

Finished in 0.00384 seconds
2 examples, 0 failures
spec/unit/util/ip_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
...............................................

Finished in 0.17125 seconds
47 examples, 0 failures
spec/unit/util/ec2_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
................

Finished in 0.03427 seconds
16 examples, 0 failures
spec/unit/util/confine_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
......................

Finished in 0.04129 seconds
22 examples, 0 failures
spec/unit/util/macosx_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..........

Finished in 0.02211 seconds
10 examples, 0 failures
spec/unit/util/macaddress_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....................

Finished in 0.23486 seconds
20 examples, 0 failures
spec/unit/util/uptime_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
......

Finished in 0.17502 seconds
6 examples, 0 failures
spec/unit/util/manufacturer_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
...........

Finished in 0.05981 seconds
11 examples, 0 failures
spec/unit/util/loader_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
......................

Finished in 1.9 seconds
22 examples, 0 failures
spec/unit/util/xendomains_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..

Finished in 0.00481 seconds
2 examples, 0 failures
spec/unit/util/vlans_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.

Finished in 0.00275 seconds
1 example, 0 failures
spec/unit/util/processor_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
FFFFFFF

Failures:

  1) Facter::Util::Processor should get the processor description from the amd64solo fixture
     Failure/Error: Facter::Util::Processor.enum_cpuinfo[0].should == "Intel(R) Core(TM)2 Duo CPU     P8700  @ 2.53GHz"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:11:in `enum_cpuinfo'
     # ./spec/unit/util/processor_spec.rb:17

  2) Facter::Util::Processor should get the processor descriptions from the amd64dual fixture
     Failure/Error: Facter::Util::Processor.enum_cpuinfo[0].should == "Intel(R) Core(TM)2 Duo CPU     P8700  @ 2.53GHz"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:11:in `enum_cpuinfo'
     # ./spec/unit/util/processor_spec.rb:26

  3) Facter::Util::Processor should get the processor descriptions from the amd64tri fixture
     Failure/Error: Facter::Util::Processor.enum_cpuinfo[0].should == "Intel(R) Core(TM)2 Duo CPU     P8700  @ 2.53GHz"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:11:in `enum_cpuinfo'
     # ./spec/unit/util/processor_spec.rb:36

  4) Facter::Util::Processor should get the processor descriptions from the amd64quad fixture
     Failure/Error: Facter::Util::Processor.enum_cpuinfo[0].should == "Quad-Core AMD Opteron(tm) Processor 2374 HE"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:11:in `enum_cpuinfo'
     # ./spec/unit/util/processor_spec.rb:47

  5) Facter::Util::Processor should get the processor type on AIX box
     Failure/Error: Facter::Util::Processor.enum_lsdev[0].should == "PowerPC_POWER3"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:70:in `enum_lsdev'
     # ./spec/unit/util/processor_spec.rb:58

  6) Facter::Util::Processor should get the processor description on Solaris (x86)
     Failure/Error: Facter::Util::Processor.enum_kstat[0].should == "Intel(r) Core(tm) i5 CPU       M 450  @ 2.40GHz"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:92:in `enum_kstat'
     # ./spec/unit/util/processor_spec.rb:66

  7) Facter::Util::Processor should get the processor description on Solaris (SPARC64)
     Failure/Error: Facter::Util::Processor.enum_kstat[0].should == "SPARC64-VII"
     NoMethodError:
       undefined method `exclusive' for Thread:Class
     # ./spec/../lib/facter/util/processor.rb:92:in `enum_kstat'
     # ./spec/unit/util/processor_spec.rb:74

Finished in 0.02752 seconds
7 examples, 7 failures

Failed examples:

rspec ./spec/unit/util/processor_spec.rb:11 # Facter::Util::Processor should get the processor description from the amd64solo fixture
rspec ./spec/unit/util/processor_spec.rb:20 # Facter::Util::Processor should get the processor descriptions from the amd64dual fixture
rspec ./spec/unit/util/processor_spec.rb:30 # Facter::Util::Processor should get the processor descriptions from the amd64tri fixture
rspec ./spec/unit/util/processor_spec.rb:41 # Facter::Util::Processor should get the processor descriptions from the amd64quad fixture
rspec ./spec/unit/util/processor_spec.rb:53 # Facter::Util::Processor should get the processor type on AIX box
rspec ./spec/unit/util/processor_spec.rb:61 # Facter::Util::Processor should get the processor description on Solaris (x86)
rspec ./spec/unit/util/processor_spec.rb:69 # Facter::Util::Processor should get the processor description on Solaris (SPARC64)
spec/unit/util/fact_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.................

Finished in 0.02895 seconds
17 examples, 0 failures
spec/unit/util/resolution_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..............................................................................................................

Finished in 0.62174 seconds
110 examples, 0 failures
spec/unit/util/config_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..

Finished in 0.0062 seconds
2 examples, 0 failures
spec/unit/operatingsystemrelease_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.............

Finished in 0.30682 seconds
13 examples, 0 failures
spec/unit/architecture_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.................

Finished in 0.08992 seconds
17 examples, 0 failures
spec/unit/virtual_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
............................................

Finished in 0.55935 seconds
44 examples, 0 failures
spec/unit/lsbmajdistrelease_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.

Finished in 0.0047 seconds
1 example, 0 failures
spec/unit/interfaces_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..

Finished in 0.01032 seconds
2 examples, 0 failures
spec/unit/processor_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.....................

Finished in 2.77 seconds
21 examples, 0 failures
spec/unit/macaddress_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.03453 seconds
4 examples, 0 failures
spec/unit/hardwaremodel_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
...

Finished in 0.01951 seconds
3 examples, 0 failures
spec/unit/hardwareisa_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.01414 seconds
4 examples, 0 failures
spec/unit/selinux_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..........

Finished in 0.04757 seconds
10 examples, 0 failures
spec/unit/domain_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
...................

Finished in 0.09605 seconds
19 examples, 0 failures
spec/unit/facter_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..............................................

Finished in 0.1486 seconds
46 examples, 0 failures
spec/unit/physicalprocessorcount_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.02047 seconds
4 examples, 0 failures
spec/unit/lsbdistcodename_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.01656 seconds
4 examples, 0 failures
spec/unit/lsbdistid_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.01663 seconds
4 examples, 0 failures
spec/unit/ipaddress6_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.02098 seconds
4 examples, 0 failures
spec/unit/memory_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
............

Finished in 1.23 seconds
12 examples, 0 failures
spec/unit/operatingsystem_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.............................

Finished in 0.20078 seconds
29 examples, 0 failures
spec/unit/lsbdistrelease_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.01656 seconds
4 examples, 0 failures
spec/unit/id_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.........

Finished in 0.03807 seconds
9 examples, 0 failures
spec/unit/uptime_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
..................

Finished in 0.25229 seconds
18 examples, 0 failures
spec/unit/lsbdistdescription_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
....

Finished in 0.01695 seconds
4 examples, 0 failures
spec/unit/ec2_spec.rb
Mocha deprecation warning: Test::Unit or MiniTest must be loaded *before* Mocha.
Mocha deprecation warning: If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'
.......

Finished in 0.04082 seconds
7 examples, 0 failures

Andy Parker

unread,
Sep 13, 2012, 12:29:24 PM9/13/12
to puppe...@googlegroups.com
On Thu, Sep 13, 2012 at 6:31 AM, Alex Harvey <alexh...@gmail.com> wrote:
> So I have made my change and am trying to run the tests.
>
> Trouble is some of the tests are failing - as well as me getting a whole
> range of warnings - even before I make my change. After making my change, I
> get the same result, suggesting I haven't broken anything.
>
> I suspect I am doing something wrong. :)
>
> About my platform -
>
> myhostfacter]# ruby -v
> ruby 1.8.7 (2008-08-11 patchlevel 72) [sparc-solaris2.10]
> myhost[facter]# gem list
>

That is a very old version of 1.8.7. I'm not going to say that it is
causing all of the problems, but I wouldn't rule it out.

> *** LOCAL GEMS ***
>
> diff-lcs (1.1.3)
> facter (1.6.7)
> metaclass (0.0.1)
> minitest (3.4.0)
> mocha (0.12.4)
> puppet (2.7.6)
> rake (0.9.2.2)
> rspec (2.11.0)
> rspec-core (2.11.1)
> rspec-expectations (2.11.3)
> rspec-mocks (2.11.2)
>

I believe that version of mocha has bugs that prevent the spec tests
from running correctly. The recommended version of mocha is 0.10.5.

> And the test results -
>
> myhost[facter]# find spec/ -name "*.rb" |while read s; do echo $s; rspec $s;
> done
> spec/puppetlabs_spec/verbose.rb
> No examples found.
>

Just running "rspec spec/" will run all of the tests and won't pick up
other files that are in there. Some of the errors are because your
script picked up files that are not tests and tried to run them.
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-dev/-/oXUtsU6EwO4J.

Alex Harvey

unread,
Sep 14, 2012, 6:33:49 AM9/14/12
to puppe...@googlegroups.com


On Friday, September 14, 2012 2:29:26 AM UTC+10, Andy Parker wrote:

I believe that version of mocha has bugs that prevent the spec tests
from running correctly. The recommended version of mocha is 0.10.5.

Yes, after downgrading to v0.10.5 of mocha the warnings disappeared.

Just running "rspec spec/" will run all of the tests and won't pick up
other files that are in there. Some of the errors are because your
script picked up files that are not tests and tried to run them.

Okay, that worked.  No test failures.  So I've submitted my pull request and updated the ticket.  Thanks for your help!

Alex Harvey

unread,
Sep 15, 2012, 10:41:00 AM9/15/12
to puppe...@googlegroups.com
Hi Andy, if you are still there I have another question - I would now like to move on to work on another bug but GitHub apparently doesn't easily let you fork multiple copies of the same repository.  I've googled and found out how you can create multiple forked copies of repos but it seems complicated enough that I am wondering if I am not meant to do this.  Maybe I should keep working with the same copy and assume git magic will allow the unrelated edits to be disentangled?  I am also somewhat new to git and GitHub.  Thanks in advance.

Daniel Pittman

unread,
Sep 15, 2012, 11:50:00 AM9/15/12
to puppe...@googlegroups.com
On Sat, Sep 15, 2012 at 7:41 AM, Alex Harvey <alexh...@gmail.com> wrote:

> Hi Andy, if you are still there I have another question - I would now like
> to move on to work on another bug but GitHub apparently doesn't easily let
> you fork multiple copies of the same repository.

It will, but you shouldn't need to - with git, you generally work in a
topic branch created from the branch you want to base your changes on.

There is a good explanation here:
https://github.com/dchelimsky/rspec/wiki/Topic-Branches

The key difference between our workflow and his is that we use GitHub
pull requests rather than patches when the changes come back.

So, where he has "git format-patch", we would have you push to your
own repository, then use GitHub to send a pull request.

We have some more documentation on the whole process over at
https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md

--
Daniel Pittman
⎋ Puppet Labs Developer – http://puppetlabs.com
♲ Made with 100 percent post-consumer electrons
Reply all
Reply to author
Forward
0 new messages