From 59386d5a8b1d2c2c2f9e8cdeb2a9e17565316033 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Wed, 5 Jan 2022 15:24:02 +0800 Subject: [PATCH] unit tests: add tests for get_dump_mode_by_fadump_val Reviewed-by: Philipp Rudo Signed-off-by: Coiby Xu --- spec/kdumpctl_general_spec.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh index e1d8698..b968f74 100644 --- a/spec/kdumpctl_general_spec.sh +++ b/spec/kdumpctl_general_spec.sh @@ -45,4 +45,30 @@ Describe 'kdumpctl' The error should include "kernel_path=ALL invalid" End End + + Describe 'get_dump_mode_by_fadump_val()' + + Context 'when given valid fadump values' + Parameters + "#1" on fadump + "#2" nocma fadump + "#3" "" kdump + "#4" off kdump + End + It "should return the dump mode correctly" + When call get_dump_mode_by_fadump_val "$2" + The output should equal "$3" + The status should be success + End + End + + It 'should complain given invalid fadump value' + When call get_dump_mode_by_fadump_val /boot/vmlinuz + The status should be failure + The error should include 'invalid fadump' + End + + End + + End