[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, experimental_upstream, updated. 1.5.9-54-g5a4eeed

Adrien Thebo adrien at puppetlabs.com
Wed Jun 22 08:51:51 UTC 2011


The following commit has been merged in the experimental_upstream branch:
commit 21fe2176f6a688da14d8382806787b6072ae1ed1
Author: Adrien Thebo <adrien.thebo at gmail.com>
Date:   Thu Apr 14 11:27:22 2011 -0700

    (#6612) Changed uptime spec to be endian agnostic
    
    The sysctl uptime fixture was little endian, which fails on sparc
    hardware. Added a big endian fixture and endian detection.

diff --git a/spec/fixtures/uptime/sysctl_kern_boottime_big_endian b/spec/fixtures/uptime/sysctl_kern_boottime_big_endian
new file mode 100644
index 0000000..6b7be22
Binary files /dev/null and b/spec/fixtures/uptime/sysctl_kern_boottime_big_endian differ
diff --git a/spec/fixtures/uptime/sysctl_kern_boottime b/spec/fixtures/uptime/sysctl_kern_boottime_little_endian
similarity index 100%
rename from spec/fixtures/uptime/sysctl_kern_boottime
rename to spec/fixtures/uptime/sysctl_kern_boottime_little_endian
diff --git a/spec/unit/util/uptime_spec.rb b/spec/unit/util/uptime_spec.rb
index 8d3980c..98a1a1b 100755
--- a/spec/unit/util/uptime_spec.rb
+++ b/spec/unit/util/uptime_spec.rb
@@ -27,7 +27,12 @@ describe Facter::Util::Uptime do
       end
 
       it "should use 'sysctl kern.boottime'" do
-        sysctl_output_file = File.join(SPECDIR, 'fixtures', 'uptime', 'sysctl_kern_boottime') # Aug 01 14:13:47 -0700 2010
+        if [1].pack("L") == [1].pack("V") # Determine endianness
+	  sysctl_output_filename = 'sysctl_kern_boottime_little_endian'
+	else
+	  sysctl_output_filename = 'sysctl_kern_boottime_big_endian'
+	end
+        sysctl_output_file = File.join(SPECDIR, 'fixtures', 'uptime', sysctl_output_filename) # Aug 01 14:13:47 -0700 2010
         Facter::Util::Uptime.stubs(:uptime_sysctl_cmd).returns("cat \"#{sysctl_output_file}\"")
         Time.stubs(:now).returns Time.parse("Aug 01 15:13:47 -0700 2010") # one hour later
         Facter::Util::Uptime.get_uptime_seconds_unix.should == 60 * 60

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list