Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
spec/kdump-lib_spec.sh | 46 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 spec/kdump-lib_spec.sh
diff --git a/spec/kdump-lib_spec.sh b/spec/kdump-lib_spec.sh
new file mode 100644
index 0000000..78d4c46
--- /dev/null
+++ b/spec/kdump-lib_spec.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+Describe 'kdump-lib'
+ Include ./kdump-lib.sh
+
+ Describe 'get_system_size()'
+
+ It 'should return correct system RAM size when there are one System RAM entry'
+ grep() {
+ %text
+ #|000000-3fffffff : System RAM
+ }
+ When call get_system_size
+ The output should equal 1
+ End
+
+ It 'should return correct system RAM size when there are three System RAM
entries'
+ grep() {
+ %text
+ #|000000-3fffffff : System RAM
+ #|000000-3fffffff : System RAM
+ #|000000-3fffffff : System RAM
+ }
+ When call get_system_size
+ The output should equal 3
+ End
+
+ End
+
+ Describe 'get_recommend_size()'
+ It 'is inclusive for the lower bound of the range of crashkernel'
+ When call get_recommend_size 1 1G-4G:192M
+ The output should equal 192M
+ End
+
+ It 'is exclusive for the lower bound of the range of crashkernel'
+ When call get_recommend_size 4 1G-4G:192M
+ The output should not equal 192M
+ End
+
+ It 'does not yet support ranges not sorted in increasing order'
+ When call get_recommend_size 1 4G-64G:256M,1G-4G:192M,64G-102400T:512M
+ The output should not equal 192M
+ End
+ End
+
+End
--
2.35.1