Skip to content

Commit

Permalink
Merge pull request #83 from gilsonsouza/master
Browse files Browse the repository at this point in the history
bsc#1045098: merge SLE-12-SP3 into master
  • Loading branch information
gilsonsouza committed Jun 22, 2017
2 parents 80e432e + 8fdbcfa commit 1f2b8ac
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package/yast2-kdump.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jun 21 09:10:56 UTC 2017 - gsouza@suse.com

- Fixed regular expression that verifies alloc_mem parameter
(bsc#1045098).
- 3.2.6

-------------------------------------------------------------------
Tue Jun 20 12:19:21 UTC 2017 - gsouza@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-kdump.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-kdump
Version: 3.2.5
Version: 3.2.6
Release: 0
Summary: Configuration of kdump
License: GPL-2.0
Expand Down
8 changes: 4 additions & 4 deletions src/clients/kdump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -735,20 +735,20 @@ def cmdKdumpShow(options)


# Only numbers are allowed as allow_mem_high and allow_mem_low values
ALLOC_MEM_REGEXP = /\D/
ALLOC_MEM_REGEXP = /\A\d+\z/

def cmdKdumpStartup(options)
options = deep_copy(options)
if Ops.get(options, "enable") != nil &&
Ops.get(options, "alloc_mem") != nil
Kdump.add_crashkernel_param = true
alloc_mem_low, alloc_mem_high = options["alloc_mem"].split(',')
Kdump.allocated_memory = { low: alloc_mem_low, high: alloc_mem_high }
unless alloc_mem_low =~ ALLOC_MEM_REGEXP &&
(alloc_mem_high.nil? || alloc_mem_high =~ ALLOC_MEM_REGEXP)
CommandLine.Error(_("Invalid allocation memory parameter"))
CommandLine.Error(_("alloc_mem parameter used with invalid values"))
return false
end
Kdump.add_crashkernel_param = true
Kdump.allocated_memory = { low: alloc_mem_low, high: alloc_mem_high }
#TRANSLATORS: CommandLine printed text
if Kdump.crashkernel_list_ranges
CommandLine.Print(
Expand Down
13 changes: 11 additions & 2 deletions test/client_test.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
require_relative "./test_helper"
require_relative "../src/clients/kdump"
Yast.import "CommandLine"

describe Yast::KdumpClient do

describe ".cmdKdumpStartup" do
let(:alloc_mem_high) {"100"}
let(:alloc_mem_low) {"50"}


context "When using wrong inputs in alloc memory" do
let(:options) {{"enable"=>"", "alloc_mem"=>"#{alloc_mem_low}:#{alloc_mem_high}"}}

it "does not enable kdump and returns false" do
expect(subject.cmdKdumpStartup(options)).to be false
end
end

context "When using alloc memory high and low" do
let(:options) {{"enable"=>"", "alloc_mem"=>"#{alloc_mem_low},#{alloc_mem_high}"}}

Expand All @@ -17,7 +26,7 @@
expect(Yast::Kdump.add_crashkernel_param).to be true
end
end

context "when using only alloc memory low" do
let(:options) {{"enable"=>"", "alloc_mem"=>"#{alloc_mem_low}"}}

Expand Down

0 comments on commit 1f2b8ac

Please sign in to comment.