aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
authorguillaume.lambert <guillaume.lambert@orange.com>2022-05-10 22:04:23 +0200
committerGuillaume Lambert <guillaume.lambert@orange.com>2023-03-21 09:13:19 +0000
commitb9fedb6868306a6e3145b7ee851ea3a84353df9c (patch)
tree0deebe33f61c377970a0c38b7679537523bca172 /functest
parent7677c43363c22c7bfca60855058af503860c63b8 (diff)
Stop bashing functest scripts
Though bash is a good interactive user shell and apart portability concerns, many UN*X systems and GNU+Linux distributions now prefers Almquist or Kornshell variants for scripting in order to improve the system performance and maintenability. https://wiki.ubuntu.com/DashAsBinSh https://mywiki.wooledge.org/Bashism https://en.wikipedia.org/wiki/Almquist_shell Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com> Change-Id: I32c5490f9eab54e6cac594f3eac1e392edf8b272
Diffstat (limited to 'functest')
-rw-r--r--functest/ci/add_proxy.sh9
-rw-r--r--functest/ci/convert_images.sh8
-rw-r--r--functest/ci/download_images.sh2
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_userdata.py2
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater.py2
5 files changed, 13 insertions, 10 deletions
diff --git a/functest/ci/add_proxy.sh b/functest/ci/add_proxy.sh
index 082141073..9d7db22e4 100644
--- a/functest/ci/add_proxy.sh
+++ b/functest/ci/add_proxy.sh
@@ -1,8 +1,9 @@
-#!/bin/bash
+#!/bin/sh
set -e
-pushd "${1:-/home/opnfv/functest/images}" > /dev/null
+initdir=$(pwd)
+cd "${1:-/home/opnfv/functest/images}"
http_proxy_host=${http_proxy_host:-proxy}
http_proxy_port=${http_proxy_port:-8080}
@@ -89,7 +90,7 @@ for image in $images; do
fi
guestmount -a "${image}" -i --rw "${tmpdir}"
add_proxy "${tmpdir}/etc/environment"
- if [[ ${image} == "ubuntu"* ]]; then
+ if expr "$image" : 'ubuntu' ; then
add_proxy_apt "${tmpdir}/etc/apt/apt.conf"
add_proxy_juju_env "${tmpdir}/etc/juju-proxy.conf"
add_proxy_juju_systemd "${tmpdir}/etc/juju-proxy-systemd.conf"
@@ -133,5 +134,5 @@ else
fi
rmdir "${tmpdir}"
-popd > /dev/null
+cd initdir
diff --git a/functest/ci/convert_images.sh b/functest/ci/convert_images.sh
index d7ed3887b..2159d2a60 100644
--- a/functest/ci/convert_images.sh
+++ b/functest/ci/convert_images.sh
@@ -1,11 +1,13 @@
-#!/bin/bash
+#!/bin/sh
set -ex
-pushd "${1:-/home/opnfv/functest/images}"
+initdir=$(pwd)
+
+cd "${1:-/home/opnfv/functest/images}"
for i in *.img *.qcow2; do
qemu-img convert -f qcow2 -O vmdk "$i" "${i%.*}.vmdk"
done
-popd
+cd $initdir
diff --git a/functest/ci/download_images.sh b/functest/ci/download_images.sh
index 72e885530..6bafc7837 100644
--- a/functest/ci/download_images.sh
+++ b/functest/ci/download_images.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
set -ex
diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py
index 7de70f677..8a8f26f37 100644
--- a/functest/opnfv_tests/openstack/vping/vping_userdata.py
+++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py
@@ -104,7 +104,7 @@ class VPingUserdata(singlevm.VmReady2):
"""
Returns the post VM creation script to be added into the VM's userdata
:param test_ip: the IP value to substitute into the script
- :return: the bash script contents
+ :return: the shell script contents
"""
ip4 = self.vm1.private_v4 or self.vm1.addresses[
self.network.name][0].addr
diff --git a/functest/opnfv_tests/vnf/ims/clearwater.py b/functest/opnfv_tests/vnf/ims/clearwater.py
index bbd5291eb..4c143fd70 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater.py
@@ -155,7 +155,7 @@ class ClearwaterTesting():
subscript = f' PROXY={self.bono_ip} ELLIS={self.ellis_ip}'
script = f'{script}{subscript}'
script = f'{script} --trace'
- cmd = f"/bin/bash -c '{script}'"
+ cmd = f"/bin/sh -c '{script}'"
self.logger.debug('Live test cmd: %s', cmd)
output_file = os.path.join(self.result_dir, "ims_test_output.txt")
ft_utils.execute_command(cmd,