Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-kdump for openSUSE:Factory checked in at 2022-12-10 21:17:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-kdump (Old) and /work/SRC/openSUSE:Factory/.yast2-kdump.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-kdump" Sat Dec 10 21:17:38 2022 rev:115 rq:1041862 version:4.5.7 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-kdump/yast2-kdump.changes 2022-12-08 16:50:29.639270715 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-kdump.new.1835/yast2-kdump.changes 2022-12-10 21:17:56.681597310 +0100 @@ -1,0 +2,10 @@ +Fri Dec 9 09:53:31 UTC 2022 - Josef Reidinger <jreidin...@suse.com> + +- Support fadump values in output of kdumptools calibrate + (jsc#PED-1927) +- drop support for older kdumptools +- remove limits when kdumptools calibrate failed to allow user + enter anything +- 4.5.7 + +------------------------------------------------------------------- Old: ---- yast2-kdump-4.5.6.tar.bz2 New: ---- yast2-kdump-4.5.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-kdump.spec ++++++ --- /var/tmp/diff_new_pack.YbKWxL/_old 2022-12-10 21:17:57.173600186 +0100 +++ /var/tmp/diff_new_pack.YbKWxL/_new 2022-12-10 21:17:57.177600210 +0100 @@ -17,7 +17,7 @@ Name: yast2-kdump -Version: 4.5.6 +Version: 4.5.7 Release: 0 Summary: Configuration of kdump License: GPL-2.0-only ++++++ yast2-kdump-4.5.6.tar.bz2 -> yast2-kdump-4.5.7.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/package/yast2-kdump.changes new/yast2-kdump-4.5.7/package/yast2-kdump.changes --- old/yast2-kdump-4.5.6/package/yast2-kdump.changes 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/package/yast2-kdump.changes 2022-12-09 13:29:54.000000000 +0100 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Fri Dec 9 09:53:31 UTC 2022 - Josef Reidinger <jreidin...@suse.com> + +- Support fadump values in output of kdumptools calibrate + (jsc#PED-1927) +- drop support for older kdumptools +- remove limits when kdumptools calibrate failed to allow user + enter anything +- 4.5.7 + +------------------------------------------------------------------- Wed Dec 7 17:14:38 UTC 2022 - Stefan Hundhammer <shundham...@suse.com> - Changed default of KDUMP_AUTO_RESIZE to "no" as documented in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/package/yast2-kdump.spec new/yast2-kdump-4.5.7/package/yast2-kdump.spec --- old/yast2-kdump-4.5.6/package/yast2-kdump.spec 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/package/yast2-kdump.spec 2022-12-09 13:29:54.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-kdump -Version: 4.5.6 +Version: 4.5.7 Release: 0 Summary: Configuration of kdump License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/src/include/kdump/dialogs.rb new/yast2-kdump-4.5.7/src/include/kdump/dialogs.rb --- old/yast2-kdump-4.5.6/src/include/kdump/dialogs.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/src/include/kdump/dialogs.rb 2022-12-09 13:29:54.000000000 +0100 @@ -415,7 +415,7 @@ "widget_names" => [ "DisBackButton", "EnableDisalbeKdump", - (Kdump.system.supports_fadump? ? "FADump" : ""), + (Kdump.fadump_supported? ? "FADump" : ""), "KdumpMemory" ] }, @@ -575,7 +575,8 @@ ) ), VSpacing(1), - Left(ReplacePoint(Id("allocated_low_memory_rp"), low_memory_widget)), + Left(ReplacePoint(Id("allocated_low_memory_rp"), + low_memory_widget(fadump: Kdump.using_fadump?))), *high_widgets ) ) @@ -614,9 +615,10 @@ # Returns the low memory widget # - # @param value [Integer] Current value + # @param value [Integer] Current value or default if nil passed + # @fadump fadump [Boolean] whener use low mem limits or fadump one # @return [Yast::Term] Low memory widget - def low_memory_widget(value = nil) + def low_memory_widget(value: nil, fadump: false) low_label = if Kdump.high_memory_supported? _("Kdump &Low Memory [MiB]") else @@ -624,23 +626,26 @@ end limits = Kdump.memory_limits - current = (limits[:min_low]..limits[:max_low]).cover?(value) ? value : limits[:default_low] + min_limit = fadump ? limits[:min_fadump] : limits[:min_low] + max_limit = fadump ? limits[:max_fadump] : limits[:max_low] + default = fadump ? limits[:default_fadump] : limits[:default_low] + current = (min_limit..max_limit).cover?(value) ? value : default VBox( IntField( Id("allocated_low_memory"), Opt(:notify), low_label, - limits[:min_low], - limits[:max_low], + min_limit, + max_limit, current ), Label( # TRANSLATORS: %{min}, %{max}, %{default} are variable names which must not be translated. format(_("(min: %{min}; max: %{max}; suggested: %{default})"), - min: limits[:min_low], - max: limits[:max_low], - default: limits[:default_low]) + min: min_limit, + max: max_limit, + default: default) ) ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/src/include/kdump/uifunctions.rb new/yast2-kdump-4.5.7/src/include/kdump/uifunctions.rb --- old/yast2-kdump-4.5.6/src/include/kdump/uifunctions.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/src/include/kdump/uifunctions.rb 2022-12-09 13:29:54.000000000 +0100 @@ -1435,7 +1435,7 @@ # Initializes FADump settings in UI def InitFADump(_key) - if Kdump.system.supports_fadump? && UI.WidgetExists(Id("FADump")) + if Kdump.fadump_supported? && UI.WidgetExists(Id("FADump")) UI.ReplaceWidget( Id("FADump"), VBox( @@ -1468,15 +1468,16 @@ UI.ChangeWidget(Id(:auto_resize), :Enabled, !use_fadump_value) update_usable_memory - refresh_kdump_memory + refresh_kdump_memory(use_fadump_value) nil end - def refresh_kdump_memory + def refresh_kdump_memory(fadump) widget_id = Id("allocated_low_memory") value = UI.QueryWidget(widget_id, :Value) - UI.ReplaceWidget(Id("allocated_low_memory_rp"), low_memory_widget(value)) + UI.ReplaceWidget(Id("allocated_low_memory_rp"), + low_memory_widget(value: value, fadump: fadump)) end # Function initializes option diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/src/lib/kdump/clients/kdump.rb new/yast2-kdump-4.5.7/src/lib/kdump/clients/kdump.rb --- old/yast2-kdump-4.5.6/src/lib/kdump/clients/kdump.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/src/lib/kdump/clients/kdump.rb 2022-12-09 13:29:54.000000000 +0100 @@ -351,7 +351,7 @@ } } - if Kdump.system.supports_fadump? + if Kdump.fadump_supported? @cmdline_description["actions"]["fadump"] = { "handler" => fun_ref(method(:cmd_handle_fadump), "boolean (map)"), # TRANSLATORS: CommandLine help @@ -718,7 +718,7 @@ CommandLine.Print("") - if Kdump.system.supports_fadump? + if Kdump.fadump_supported? show_fadump_status CommandLine.Print("") end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/src/lib/kdump/kdump_calibrator.rb new/yast2-kdump-4.5.7/src/lib/kdump/kdump_calibrator.rb --- old/yast2-kdump-4.5.6/src/lib/kdump/kdump_calibrator.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/src/lib/kdump/kdump_calibrator.rb 2022-12-09 13:29:54.000000000 +0100 @@ -11,19 +11,19 @@ class KdumpCalibrator include Yast::Logger - LOW_MEM = 896 - MIN_LOW_DEFAULT = 72 - KDUMPTOOL_CMD = "/usr/sbin/kdumptool %s calibrate".freeze KDUMPTOOL_ARG = "--configfile '%s'".freeze KEYS_MAP = { - "Low" => :default_low, - "MinLow" => :min_low, - "MaxLow" => :max_low, - "High" => :default_high, - "MinHigh" => :min_high, - "MaxHigh" => :max_high, - "Total" => :total_memory + "Low" => :default_low, + "MinLow" => :min_low, + "MaxLow" => :max_low, + "High" => :default_high, + "MinHigh" => :min_high, + "MaxHigh" => :max_high, + "Fadump" => :default_fadump, + "MinFadump" => :min_fadump, + "MaxFadump" => :max_fadump, + "Total" => :total_memory }.freeze def initialize(configfile = nil) @@ -38,6 +38,13 @@ !max_high.zero? end + # Determines whether fadump support is available + # + # @return [Boolean] true if it's available; 'false' otherwise. + def fadump_supported? + !max_fadump.zero? + end + # Determines what's the recommended quantity of low memory # # If high memory is not supported, this is the total recommended memory. @@ -55,7 +62,7 @@ # @return [Fixnum] Memory size (in MiB) def min_low run_kdumptool unless @kdumptool_executed - @min_low ||= MIN_LOW_DEFAULT + @min_low ||= 0 end # Determines what's the recommended maximum quantity of low memory @@ -65,7 +72,7 @@ # @return [Fixnum] Memory size (in MiB) def max_low run_kdumptool unless @kdumptool_executed - @max_low ||= system.supports_high_mem? ? [LOW_MEM, total_memory].min : total_memory + @max_low ||= total_memory end # Determines what's the recommended quantity of high memory @@ -84,19 +91,40 @@ @min_high ||= 0 end - # Determines what's the recommended maximum quantity of low memory + # Determines what's the recommended maximum quantity of high memory # # If high memory is not supported, this is 0. # # @return [Fixnum] Memory size (in MiB) def max_high run_kdumptool unless @kdumptool_executed - @max_high ||= - if system.supports_high_mem? - (total_memory - LOW_MEM) > 0 ? total_memory - LOW_MEM : 0 - else - 0 - end + @max_high ||= system.supports_high_mem? ? total_memory : 0 + end + + # Determines what's the recommended quantity of fadump memory + # + # @return [Fixnum] Memory size (in MiB) + def default_fadump + run_kdumptool unless @kdumptool_executed + @default_fadump ||= min_fadump + end + + # Determines what's the minimum quantity of fadump memory + # + # @return [Fixnum] Memory size (in MiB) + def min_fadump + run_kdumptool unless @kdumptool_executed + @min_fadump ||= 0 + end + + # Determines what's the recommended maximum quantity of fadump memory + # + # If fadump is not supported, this is 0. + # + # @return [Fixnum] Memory size (in MiB) + def max_fadump + run_kdumptool unless @kdumptool_executed + @max_fadump ||= system.supports_fadump? ? total_memory : 0 end # System available memory @@ -115,8 +143,11 @@ # # @return [Hash] Memory limits def memory_limits - { min_low: min_low, max_low: max_low, default_low: default_low, - min_high: min_high, max_high: max_high, default_high: default_high } + { + min_low: min_low, max_low: max_low, default_low: default_low, + min_high: min_high, max_high: max_high, default_high: default_high, + min_fadump: min_fadump, max_fadump: max_fadump, default_fadump: default_fadump + } end private @@ -131,13 +162,17 @@ def run_kdumptool out = Yast::SCR.Execute(Yast::Path.new(".target.bash_output"), kdumptool_cmd) if out["exit"].zero? + # If fadump is missing from output, it means it isn't supported (unlike + # high mem, which is always in output). Thus, let's set fadump related + # values to zero before parsing the kdumptool output + @max_fadump = @min_fadump = @default_fadump = 0 proposal = parse(out["stdout"]) # Populate @min_low, @max_low, @total_memory, etc. proposal.each_pair do |var_name, var_value| instance_variable_set("@#{var_name}", var_value) end else - log.warn("kdumptool could not be executed: #{out["stderr"]}") + log.warn("kdumptool failed: #{out["stderr"]}") end @kdumptool_executed = true end @@ -149,14 +184,9 @@ # @return [Hash] Hash containing minimum and maximum low/high memory limits def parse(output) lines = output.split("\n") - if lines.size == 1 # Old kdumptool version - low = lines.first.to_i - { min_low: low, default_low: low } - else - lines.each_with_object({}) do |line, prop| - key, value = line.split(":").map(&:strip) - prop[KEYS_MAP[key]] = value.to_i if KEYS_MAP.key?(key) - end + lines.each_with_object({}) do |line, prop| + key, value = line.split(":").map(&:strip) + prop[KEYS_MAP[key]] = value.to_i if KEYS_MAP.key?(key) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/src/modules/Kdump.rb new/yast2-kdump-4.5.7/src/modules/Kdump.rb --- old/yast2-kdump-4.5.6/src/modules/Kdump.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/src/modules/Kdump.rb 2022-12-09 13:29:54.000000000 +0100 @@ -344,12 +344,10 @@ # jsc#SLE-21644 for more information. # # @return [Hash] The hash contains the following keys: :min_low, :max_low, - # :default_low, :min_high, :max_high, :default_high + # :default_low, :min_high, :max_high, :default_high, :min_fadump, + # :max_fadump, :default_fadump def memory_limits - limits = calibrator.memory_limits - return limits unless using_fadump? - - limits.merge(min_low: 0, max_low: total_memory) + calibrator.memory_limits end # Propose reserved/allocated memory @@ -421,10 +419,7 @@ return true unless using_fadump_changed? - # See FATE#315780 - # See https://www.suse.com/support/kb/doc.php?id=7012786 - # FIXME what about dracut? - update_command = (using_fadump? ? "/usr/sbin/mkdumprd -f" : "/sbin/mkinitrd") + update_command = "/usr/sbin/mkdumprd -f" update_initrd_with(update_command) end @@ -1022,7 +1017,7 @@ # @return [Boolean] whether successfully set def use_fadump(new_value) # Trying to use fadump on unsupported hardware - if !system.supports_fadump? && new_value + if !fadump_supported? && new_value Builtins.y2milestone("FADump is not supported on this hardware") Report.Error(_("Cannot use Firmware-assisted dump.\nIt is not supported on this hardware.")) return false @@ -1054,6 +1049,13 @@ calibrator.high_memory_supported? end + # Returns whether usage of fadump is supported by the current system + # + # @return [Boolean] is supported + def fadump_supported? + calibrator.fadump_supported? + end + publish :function => :GetModified, :type => "boolean ()" publish :function => :SetModified, :type => "void ()" publish :variable => :modified, :type => "boolean" @@ -1229,7 +1231,7 @@ end def write_fadump_boot_param - if system.supports_fadump? + if fadump_supported? # If fdump is selected and we want to enable kdump value = "on" if using_fadump? && @add_crashkernel_param Bootloader.modify_kernel_params(:common, :recovery, "fadump" => value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/test/fadump_test.rb new/yast2-kdump-4.5.7/test/fadump_test.rb --- old/yast2-kdump-4.5.6/test/fadump_test.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/test/fadump_test.rb 2022-12-09 13:29:54.000000000 +0100 @@ -6,7 +6,7 @@ describe "#use_fadump" do before do - allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return(supported) + allow(Yast::Kdump).to receive(:fadump_supported?).and_return(supported) end context "if fadump is supported on this architecture" do @@ -37,7 +37,7 @@ describe "#using_fadump?" do it "returns that fadump is in use if previously set" do - allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return(true) + allow(Yast::Kdump).to receive(:fadump_supported?).and_return(true) Yast::Kdump.use_fadump(true) expect(Yast::Kdump.using_fadump?).to eq(true) @@ -55,7 +55,7 @@ end it "returns true if use_fadump changed" do - allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return(true) + allow(Yast::Kdump).to receive(:fadump_supported?).and_return(true) Yast::Kdump.ReadKdumpSettings original_value = Yast::Kdump.using_fadump? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/test/kdump_test.rb new/yast2-kdump-4.5.7/test/kdump_test.rb --- old/yast2-kdump-4.5.6/test/kdump_test.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/test/kdump_test.rb 2022-12-09 13:29:54.000000000 +0100 @@ -429,7 +429,7 @@ describe ".WriteKdumpBootParameter" do before do # FIXME: current tests do not cover fadump (ppc64 specific) - allow(Yast::Kdump.system).to receive(:supports_fadump?).and_return false + allow(Yast::Kdump).to receive(:fadump_supported?).and_return false end context "during autoinstallation" do @@ -963,12 +963,15 @@ describe ".memory_limits" do let(:limits) do { - min_low: 72, - max_low: 3154, - default_low: 72, - min_high: 0, - max_high: 4247, - default_high: 323 + min_low: 72, + max_low: 3154, + default_low: 72, + min_high: 0, + max_high: 4247, + default_high: 323, + min_fadump: 0, + max_fadump: 8096, + default_fadump: 512 } end @@ -989,26 +992,17 @@ it "returns a hash containing the memory limits from the calibrator" do expect(subject.memory_limits).to eq( - min_low: 72, - max_low: 3154, - default_low: 72, - min_high: 0, - max_high: 4247, - default_high: 323 + min_low: 72, + max_low: 3154, + default_low: 72, + min_high: 0, + max_high: 4247, + default_high: 323, + min_fadump: 0, + max_fadump: 8096, + default_fadump: 512 ) end - - context "when fadump is enabled" do - let(:fadump?) { true } - - it "returns the total memory as limit :max_low limit" do - expect(subject.memory_limits[:max_low]).to eq(16334) - end - - it "returns :min_low as 0" do - expect(subject.memory_limits[:min_low]).to eq(0) - end - end end describe ".update_initrd" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-kdump-4.5.6/test/lib/kdump/kdump_calibrator_test.rb new/yast2-kdump-4.5.7/test/lib/kdump/kdump_calibrator_test.rb --- old/yast2-kdump-4.5.6/test/lib/kdump/kdump_calibrator_test.rb 2022-12-07 18:57:29.000000000 +0100 +++ new/yast2-kdump-4.5.7/test/lib/kdump/kdump_calibrator_test.rb 2022-12-09 13:29:54.000000000 +0100 @@ -10,17 +10,19 @@ KDUMPTOOL_OK = { "exit" => 0, "stdout" => "Low: 108\nMinLow: 32\nMaxLow: 712\n"\ - "High: 2048\nMinHigh: 1024\nMaxHigh: 4096\nTotal: 16079\n" + "High: 2048\nMinHigh: 1024\nMaxHigh: 4096\n"\ + "Fadump: 0\nMinFadump: 0\nMaxFadump: 0\nTotal: 16079\n" }.freeze - KDUMPTOOL_OLD = { "exit" => 0, "stdout" => "64\n" }.freeze KDUMPTOOL_ERROR = { "exit" => 1, "stdout" => "" }.freeze let(:configfile) { "/var/lib/YaST2/kdump.conf" } let(:x86_64) { true } + let(:ppc64) { false } let(:kdumptool_output) { KDUMPTOOL_OK } before do allow(Yast::Arch).to receive(:x86_64).and_return(x86_64) + allow(Yast::Arch).to receive(:ppc64).and_return(ppc64) allow(Yast::SCR).to receive(:Execute) .with(Yast::Path.new(".target.bash_output"), anything).and_return(kdumptool_output) allow(Yast::SCR).to receive(:Read).with(path(".probe.memory")) @@ -38,8 +40,8 @@ end end - context "when kdumptool fails or uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } + context "when kdumptool fails" do + let(:kdumptool_output) { KDUMPTOOL_ERROR } it "returns total memory as reported by SCR" do expect(subject.total_memory).to eq(4096) @@ -54,19 +56,11 @@ end end - context "when kdumptool uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } - - it "returns the value found by kdumptool" do - expect(subject.min_low).to eq(64) - end - end - context "when kdumptool does not succeed" do let(:kdumptool_output) { KDUMPTOOL_ERROR } - it "returns 72" do - expect(subject.min_low).to eq(72) + it "returns 0" do + expect(subject.min_low).to eq(0) end end end @@ -78,22 +72,15 @@ end end - context "when kdumptool uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } - - it "returns the value found by kdumptool" do - expect(subject.default_low).to eq(64) - end - end - context "when kdumptool does not succeed" do let(:kdumptool_output) { KDUMPTOOL_ERROR } - it "returns the fallback minimal margin" do - expect(subject.default_low).to eq(72) + it "returns 0" do + expect(subject.default_low).to eq(0) end end end + context "#max_low" do context "when kdumptool succeeds" do it "returns the value found in kdumptool" do @@ -101,36 +88,16 @@ end end - context "when kdumptool fails or uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } + context "when kdumptool fails" do + let(:kdumptool_output) { KDUMPTOOL_ERROR } + let(:total_memory) { 4096 } before do allow(subject).to receive(:total_memory).and_return(total_memory) end - context "when high memory is supported" do - let(:total_memory) { 4096 } - - it "returns 896" do - expect(subject.max_low).to eq(896) - end - end - - context "when high memory is not supported" do - let(:total_memory) { 4096 } - let(:x86_64) { false } - - it "returns system memory" do - expect(subject.max_low).to eq(total_memory) - end - end - - context "when high memory is supported but the available memory is small" do - let(:total_memory) { 784 } - - it "returns system memory" do - expect(subject.max_low).to eq(total_memory) - end + it "returns total_memory" do + expect(subject.max_low).to eq(4096) end end end @@ -144,14 +111,6 @@ end end - context "when kdumptool uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } - - it "returns 0" do - expect(subject.min_high).to eq(0) - end - end - context "when kdumptool fails" do let(:kdumptool_output) { KDUMPTOOL_ERROR } @@ -170,14 +129,6 @@ end end - context "when kdumptool uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } - - it "returns 0 (the minimum fallback)" do - expect(subject.default_high).to eq(0) - end - end - context "when kdumptool fails" do let(:kdumptool_output) { KDUMPTOOL_ERROR } @@ -200,32 +151,10 @@ context "when high memory is supported" do let(:x86_64) { true } - it "returns total_memory - 896" do + it "returns total_memory" do allow(subject).to receive(:total_memory).and_return(4096) - expect(subject.max_high).to eq(3200) - end - end - - context "when high memory is not supported" do - let(:x86_64) { false } - - it "returns 0" do - expect(subject.max_high).to eq(0) - end - end - end - - context "when kdumptool uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } - - context "when high memory is supported" do - let(:x86_64) { true } - - it "returns total_memory - 896" do - allow(subject).to receive(:total_memory).and_return(4096) - - expect(subject.max_high).to eq(3200) + expect(subject.max_high).to eq(4096) end end @@ -281,18 +210,136 @@ end end end + end - context "when kdumptool uses the old format" do - let(:kdumptool_output) { KDUMPTOOL_OLD } + describe "#min_fadump" do + context "when kdumptool succeeds" do + let(:kdumptool_output) do + { + "exit" => 0, + "stdout" => "Low: 108\nMinLow: 32\nMaxLow: 712\n"\ + "High: 2048\nMinHigh: 1024\nMaxHigh: 4096\n"\ + "Fadump: 256\nMinFadump: 128\nMaxFadump: 8192\nTotal: 16079\n" + } + end + + it "returns the value found by kdumptool" do + expect(subject.min_fadump).to eq(128) + end + end + + context "when kdumptool fails" do + let(:kdumptool_output) { KDUMPTOOL_ERROR } + + it "returns 0" do + expect(subject.min_fadump).to eq(0) + end + end + end + + describe "#default_fadump" do + context "when kdumptool succeeds" do + let(:kdumptool_output) do + { + "exit" => 0, + "stdout" => "Low: 108\nMinLow: 32\nMaxLow: 712\n"\ + "High: 2048\nMinHigh: 1024\nMaxHigh: 4096\n"\ + "Fadump: 256\nMinFadump: 128\nMaxFadump: 8192\nTotal: 16079\n" + } + end + + it "returns the value found by kdumptool" do + expect(subject.default_fadump).to eq(256) + end + end + + context "when kdumptool fails" do + let(:kdumptool_output) { KDUMPTOOL_ERROR } + + it "returns 0 (the minimum fallback)" do + expect(subject.default_fadump).to eq(0) + end + end + end + + describe "#max_fadump" do + context "when kdumptool succeeds" do + let(:kdumptool_output) do + { + "exit" => 0, + "stdout" => "Low: 108\nMinLow: 32\nMaxLow: 712\n"\ + "High: 2048\nMinHigh: 1024\nMaxHigh: 4096\n"\ + "Fadump: 256\nMinFadump: 128\nMaxFadump: 8192\nTotal: 16079\n" + } + end + + it "returns the value found by kdumptool" do + expect(subject.max_fadump).to eq(8192) + end + end + + context "when kdumptool fails" do + let(:kdumptool_output) { KDUMPTOOL_ERROR } + + context "when fadump memory is supported" do + let(:ppc64) { true } + + it "returns total_memory" do + allow(subject).to receive(:total_memory).and_return(4096) + + expect(subject.max_fadump).to eq(4096) + end + end + + context "when fadump memory is not supported" do + let(:ppc64) { false } + + it "returns 0" do + expect(subject.max_fadump).to eq(0) + end + end + end + end + + describe "#fadump_supported?" do + subject(:supported) { described_class.new(configfile).fadump_supported? } + + context "when kdumptool succeeds" do + context "if kdumptool allows fadump memory" do + let(:kdumptool_output) do + { + "exit" => 0, + "stdout" => "Low: 108\nMinLow: 32\nMaxLow: 712\n"\ + "High: 2048\nMinHigh: 1024\nMaxHigh: 4096\n"\ + "Fadump: 256\nMinFadump: 128\nMaxFadump: 8192\nTotal: 16079\n" + } + end - context "when architecture is x86_64" do it "returns true" do expect(supported).to eq(true) end end - context "when architecture is not x86_64" do - let(:x86_64) { false } + context "if kdumptool returns 0 for fadump memory" do + it "returns false" do + expect(supported).to eq(false) + end + end + end + + context "when kdumptool fails" do + let(:kdumptool_output) { KDUMPTOOL_ERROR } + + context "when architecture is ppc64" do + let(:ppc64) { true } + + it "returns true" do + expect(supported).to eq(true) + end + end + + context "when architecture is not ppc64" do + let(:ppc64) { false } it "returns false" do expect(supported).to eq(false)