On Mon, Feb 21, 2022 at 08:57:42PM +0800, Coiby Xu wrote:
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
spec/kdumpctl_general_spec.sh | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh
index 2f60daa..86894d8 100644
--- a/spec/kdumpctl_general_spec.sh
+++ b/spec/kdumpctl_general_spec.sh
@@ -68,5 +68,35 @@ Describe 'kdumpctl'
End
+ Describe "read_proc_environ_var()"
+ environ_test_file=$(mktemp -t spec_test_environ_test_file.XXXXXXXXXX)
+ echo -ne
"container=bwrap-osbuild\x00SSH_AUTH_SOCK=/tmp/ssh-XXXXXXEbw33A/agent.1794\x00SSH_AGENT_PID=1929\x00env=test_env"
>$environ_test_file
+ Parameters
+ container bwrap-osbuild
+ SSH_AUTH_SOCK /tmp/ssh-XXXXXXEbw33A/agent.1794
+ env test_env
+ not_exist ""
+ End
+ It 'should read the environ variable value as expected'
+ When call read_proc_environ_var "$1" "$environ_test_file"
+ The output should equal "$2"
+ The status should be success
+ End
Should we add a clean up here?
rm -f $environ_test_file
+ End
+
+ Describe "_is_osbuild()"
+ environ_test_file=$(mktemp -t spec_test_environ_test_file.XXXXXXXXXX)
+ _OSBUILD_ENVIRON_PATH="$environ_test_file"
+ Parameters
+ 'container=bwrap-osbuild' success
+ '' failure
+ End
+ It 'should be able to tell if it is the osbuild environment'
+ echo -ne "$1" >$environ_test_file
+ When call _is_osbuild
+ The status should be $2
+ The stderr should equal ""
+ End
I noticed there are a few places where the temp files are not cleaned up
after mktemp. These files should be cleaned, otherwise /tmp folder will
be messed up.
+ End
End
--
2.34.1
_______________________________________________
kexec mailing list -- kexec(a)lists.fedoraproject.org
To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure