From e44958cad8bd997322b213a88881fe874641050d Mon Sep 17 00:00:00 2001 From: Lichen Liu Date: Tue, 14 Oct 2025 11:43:04 +0800 Subject: [PATCH 2/2] unit tests: Add case for quoted configuration values This adds a unit test to ensure `kdump_get_conf_val` correctly strips surrounding quotes from configuration options. This test case covers the bug fixed in the previous commit. Signed-off-by: Lichen Liu --- spec/kdump-lib-initramfs_spec.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/kdump-lib-initramfs_spec.sh b/spec/kdump-lib-initramfs_spec.sh index 2cb85bb..acabc2f 100644 --- a/spec/kdump-lib-initramfs_spec.sh +++ b/spec/kdump-lib-initramfs_spec.sh @@ -12,6 +12,7 @@ Describe 'kdump-lib-initramfs' #|dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" #|sshkey /root/.ssh/kdump_id_rsa #|ssh user@my.server.com + #|core_collector "makedumpfile -l --message-level 7 -d 31" } kdump_config >$KDUMP_CONFIG_FILE Context 'Given different cases' @@ -21,6 +22,7 @@ Describe 'kdump-lib-initramfs' # - complicate value for dracut_args # - Given two parameters, retrive one parameter that has value specified # - Given two parameters (in reverse order), retrive one parameter that has value specified + # - values are enclosed in quotes Parameters "#1" nfs my.server.com:/export/tmp "#2" ssh user@my.server.com @@ -28,6 +30,7 @@ Describe 'kdump-lib-initramfs' "#4" dracut_args '--omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"' "#5" 'ssh\|aaa' user@my.server.com "#6" 'aaa\|ssh' user@my.server.com + "#7" core_collector "makedumpfile -l --message-level 7 -d 31" End It 'should handle all cases correctly' -- 2.51.1