summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2020-12-11 15:49:18 +0100
committerAndrei Pavel <andrei@isc.org>2020-12-14 11:08:11 +0100
commit5e929e210d2a0aff7f9e3f2704372abfc3879110 (patch)
treedcf111855956102e80fbc0771bca48a49e156966
parent[#1574] ${var+x}, ${var-x} changes (diff)
downloadkea-5e929e210d2a0aff7f9e3f2704372abfc3879110.tar.xz
kea-5e929e210d2a0aff7f9e3f2704372abfc3879110.zip
[#1574] shell scripts: remove_if_exists
-rw-r--r--src/lib/testutils/dhcp_test_lib.sh.in30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/lib/testutils/dhcp_test_lib.sh.in b/src/lib/testutils/dhcp_test_lib.sh.in
index 161bfa4d8a..6cdb484afd 100644
--- a/src/lib/testutils/dhcp_test_lib.sh.in
+++ b/src/lib/testutils/dhcp_test_lib.sh.in
@@ -539,6 +539,15 @@ cleanup() {
kill_processes_by_name "kea-lfc"
# Remove temporary files.
+ remove_if_exists \
+ "${CA_CFG_FILE-}" \
+ "${CFG_FILE-}" \
+ "${D2_CFG_FILE-}" \
+ "${DHCP4_CFG_FILE-}" \
+ "${DHCP6_CFG_FILE-}" \
+ "${KEACTRL_CFG_FILE-}" \
+ "${NC_CFG_FILE-}"
+
# Use ${var+x} to test if ${var} is defined.
if test -n "${LOG_FILE+x}" && test -n "${LOG_FILE}"; then
rm -rf "${LOG_FILE}"
@@ -550,27 +559,6 @@ cleanup() {
if test -n "${LEASE_FILE+x}" && test -n "${LEASE_FILE}"; then
rm -rf "${LEASE_FILE}"*
fi
- if test -n "${CFG_FILE+x}" && test -n "${CFG_FILE}"; then
- rm -rf "${CFG_FILE}"
- fi
- if test -n "${DHCP4_CFG_FILE+x}" && test -n "${DHCP4_CFG_FILE}"; then
- rm -rf "${DHCP4_CFG_FILE}"
- fi
- if test -n "${DHCP6_CFG_FILE+x}" && test -n "${DHCP6_CFG_FILE}"; then
- rm -rf "${DHCP6_CFG_FILE}"
- fi
- if test -n "${D2_CFG_FILE+x}" && test -n "${D2_CFG_FILE}"; then
- rm -rf "${D2_CFG_FILE}"
- fi
- if test -n "${CA_CFG_FILE+x}" && test -n "${CA_CFG_FILE}"; then
- rm -rf "${CA_CFG_FILE}"
- fi
- if test -n "${NC_CFG_FILE+x}" && test -n "${NC_CFG_FILE}"; then
- rm -rf "${NC_CFG_FILE}"
- fi
- if test -n "${KEACTRL_CFG_FILE+x}" && test -n "${KEACTRL_CFG_FILE}"; then
- rm -rf "${KEACTRL_CFG_FILE}"
- fi
}
# Exists the test in the clean way.