add install-rpm to install/remove and ldd test for rpm packages
Signed-off-by: Wang Yong wangyong0117@qq.com --- distro/depends/install-rpm | 1 + jobs/install-rpm.yaml | 4 ++ tests/install-rpm | 83 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 distro/depends/install-rpm create mode 100755 jobs/install-rpm.yaml create mode 100755 tests/install-rpm
diff --git a/distro/depends/install-rpm b/distro/depends/install-rpm new file mode 100644 index 000000000..602479c9a --- /dev/null +++ b/distro/depends/install-rpm @@ -0,0 +1 @@ +dnf-plugins-core diff --git a/jobs/install-rpm.yaml b/jobs/install-rpm.yaml new file mode 100755 index 000000000..9afa9d992 --- /dev/null +++ b/jobs/install-rpm.yaml @@ -0,0 +1,4 @@ +suite: install-rpm +category: functional + +install-rpm: diff --git a/tests/install-rpm b/tests/install-rpm new file mode 100755 index 000000000..d69d2d4c1 --- /dev/null +++ b/tests/install-rpm @@ -0,0 +1,83 @@ +#!/bin/bash +# - compat_os +# - rpm_name +# - custom_repo_name +# - custom_repo_addr +# user can add custom_repo_name and custom_repo_addr to setup +# local repo, value can be an array + +. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh +. $LKP_SRC/lib/log.sh + +: "${compat_os:=budding-openeuler}" +: "${DISTRO:=openeuler}" +: "${basearch:=$(arch)}" +. $LKP_SRC/distro/${DISTRO} + +[ -n "${rpm_name}" ] || die "rpm_name is empty" +[ -n "${custom_repo_name}" ] || die "custom_repo_name is empty" +[ -n "${custom_repo_addr}" ] || die "custom_repo_addr is empty" + +custom_repo_name=($custom_repo_name) +custom_repo_addr=($custom_repo_addr) +rpm_name=($rpm_name) + +add_repo() +{ + custom_repo_name=($custom_repo_name) + custom_repo_addr=($custom_repo_addr) + + for i in ${!custom_repo_name[@]} + do + cat <<EOF >> /etc/yum.repos.d/"${custom_repo_name[$i]}.repo" +[${custom_repo_name[$i]}] +name=${custom_repo_name[$i]} +baseurl=${custom_repo_addr[$i]} +enabled=1 +gpgcheck=0 +priority=100 + +EOF + done +} + +install_rpm() +{ + log_info "Starting install test: yum install -y ${rpm_name[@]}" + yum install -y ${rpm_name[@]} + + return 0 +} + +ldd_test() +{ + log_info "Starting ldd test" + for i in $(rpm -qa ${rpm_name[@]}) + do + ldd_list=$(rpm -ql $i | awk -F'/' '$3 ~ /bin|sbin|lib|lib64/') + [ -z "${ldd_list}" ] || { + for i in ${ldd_list[@]} + do + [[ -f "$i" && -x "$i" ]] && { + echo "ldd for $i" + ldd -d -r $i + } + done + } + done +} + +remove_rpm() +{ + log_info "Starting remove test: yum remove -y ${rpm_name[@]}" + yum remove -y ${rpm_name[@]} + + return 0 +} + +distro_install_depends install-rpm +add_repo +install_rpm +ldd_test +remove_rpm
On Mon, Apr 26, 2021 at 04:08:29PM +0800, Wang Yong wrote:
add install-rpm to install/remove and ldd test for rpm packages
Signed-off-by: Wang Yong wangyong0117@qq.com
distro/depends/install-rpm | 1 + jobs/install-rpm.yaml | 4 ++ tests/install-rpm | 83 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 distro/depends/install-rpm create mode 100755 jobs/install-rpm.yaml create mode 100755 tests/install-rpm
diff --git a/distro/depends/install-rpm b/distro/depends/install-rpm new file mode 100644 index 000000000..602479c9a --- /dev/null +++ b/distro/depends/install-rpm @@ -0,0 +1 @@ +dnf-plugins-core diff --git a/jobs/install-rpm.yaml b/jobs/install-rpm.yaml new file mode 100755 index 000000000..9afa9d992 --- /dev/null +++ b/jobs/install-rpm.yaml @@ -0,0 +1,4 @@ +suite: install-rpm +category: functional
+install-rpm: diff --git a/tests/install-rpm b/tests/install-rpm new file mode 100755 index 000000000..d69d2d4c1 --- /dev/null +++ b/tests/install-rpm @@ -0,0 +1,83 @@ +#!/bin/bash +# - compat_os +# - rpm_name +# - custom_repo_name +# - custom_repo_addr +# user can add custom_repo_name and custom_repo_addr to setup +# local repo, value can be an array
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh +. $LKP_SRC/lib/log.sh
+: "${compat_os:=budding-openeuler}" +: "${DISTRO:=openeuler}" +: "${basearch:=$(arch)}" +. $LKP_SRC/distro/${DISTRO}
+[ -n "${rpm_name}" ] || die "rpm_name is empty" +[ -n "${custom_repo_name}" ] || die "custom_repo_name is empty" +[ -n "${custom_repo_addr}" ] || die "custom_repo_addr is empty"
+custom_repo_name=($custom_repo_name) +custom_repo_addr=($custom_repo_addr) +rpm_name=($rpm_name)
+add_repo() +{
- custom_repo_name=($custom_repo_name)
- custom_repo_addr=($custom_repo_addr)
- for i in ${!custom_repo_name[@]}
- do
cat <<EOF >> /etc/yum.repos.d/"${custom_repo_name[$i]}.repo"
+[${custom_repo_name[$i]}] +name=${custom_repo_name[$i]} +baseurl=${custom_repo_addr[$i]} +enabled=1 +gpgcheck=0 +priority=100
+EOF
- done
Here can be aligned too.
-------- Thanks, Xijian
On Mon, Apr 26, 2021 at 05:35:25PM +0800, Xu Xijian wrote:
On Mon, Apr 26, 2021 at 04:08:29PM +0800, Wang Yong wrote:
add install-rpm to install/remove and ldd test for rpm packages
Signed-off-by: Wang Yong wangyong0117@qq.com
distro/depends/install-rpm | 1 + jobs/install-rpm.yaml | 4 ++ tests/install-rpm | 83 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 distro/depends/install-rpm create mode 100755 jobs/install-rpm.yaml create mode 100755 tests/install-rpm
diff --git a/distro/depends/install-rpm b/distro/depends/install-rpm new file mode 100644 index 000000000..602479c9a --- /dev/null +++ b/distro/depends/install-rpm @@ -0,0 +1 @@ +dnf-plugins-core diff --git a/jobs/install-rpm.yaml b/jobs/install-rpm.yaml new file mode 100755 index 000000000..9afa9d992 --- /dev/null +++ b/jobs/install-rpm.yaml @@ -0,0 +1,4 @@ +suite: install-rpm +category: functional
+install-rpm: diff --git a/tests/install-rpm b/tests/install-rpm new file mode 100755 index 000000000..d69d2d4c1 --- /dev/null +++ b/tests/install-rpm @@ -0,0 +1,83 @@ +#!/bin/bash +# - compat_os +# - rpm_name +# - custom_repo_name +# - custom_repo_addr +# user can add custom_repo_name and custom_repo_addr to setup +# local repo, value can be an array
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh +. $LKP_SRC/lib/log.sh
+: "${compat_os:=budding-openeuler}" +: "${DISTRO:=openeuler}" +: "${basearch:=$(arch)}" +. $LKP_SRC/distro/${DISTRO}
+[ -n "${rpm_name}" ] || die "rpm_name is empty" +[ -n "${custom_repo_name}" ] || die "custom_repo_name is empty" +[ -n "${custom_repo_addr}" ] || die "custom_repo_addr is empty"
+custom_repo_name=($custom_repo_name) +custom_repo_addr=($custom_repo_addr) +rpm_name=($rpm_name)
+add_repo() +{
- custom_repo_name=($custom_repo_name)
- custom_repo_addr=($custom_repo_addr)
- for i in ${!custom_repo_name[@]}
- do
cat <<EOF >> /etc/yum.repos.d/"${custom_repo_name[$i]}.repo"
+[${custom_repo_name[$i]}] +name=${custom_repo_name[$i]} +baseurl=${custom_repo_addr[$i]} +enabled=1 +gpgcheck=0 +priority=100
+EOF
- done
Here can be aligned too.
ok
Thanks, Yong
Thanks, Xijian