From cfef41660d09596754960473e320e52134eff928 Mon Sep 17 00:00:00 2001 From: Johnny Hughes Date: Jan 03 2019 19:54:22 +0000 Subject: Merge pull request #31 from psgreco/devel Fix tests for armhfp and different java versions --- diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh index ed6a3a8..6898171 100755 --- a/tests/0_lib/functions.sh +++ b/tests/0_lib/functions.sh @@ -142,6 +142,18 @@ function t_Assert_Equals [ $1 -eq $2 ] t_CheckExitStatus $? } +function t_Select_Alternative +{ + name=$1 + search=$2 + option=$(/bin/echo|/usr/sbin/alternatives --config "$name"|/bin/grep -E "$search"|/usr/bin/head -n1|sed 's/ .*//g;s/[^0-9]//g') + if [ -z "$option" ];then + t_Log "Option not found for altenative $search of $name" + t_CheckExitStatus 1 + fi + t_Log "Selecing alternative $option for $name--$search" + /bin/echo "$option"|/usr/sbin/alternatives --config "$name" >/dev/null 2>&1 +} export -f t_Log export -f t_CheckExitStatus export -f t_InstallPackage @@ -156,5 +168,6 @@ export -f t_GetArch export -f t_CheckForPort export -f t_Assert export -f t_Assert_Equals +export -f t_Select_Alternative export centos_ver export arch diff --git a/tests/p_diffutils/10-cmp-tests b/tests/p_diffutils/10-cmp-tests index 2c95efd..76504b0 100755 --- a/tests/p_diffutils/10-cmp-tests +++ b/tests/p_diffutils/10-cmp-tests @@ -1,14 +1,6 @@ #!/bin/bash # Author: Iain Douglas -uname_arch=$(uname -m) - -if [ "$uname_arch" == "armv7l" ]; then - t_Log "*** Not testing on Arch: $uname_arch ***" - exit 0 -fi - - # Tests for cmp function ExitFail { diff --git a/tests/p_git/0-install_git.sh b/tests/p_git/0-install_git.sh index 682830d..40d8bfb 100755 --- a/tests/p_git/0-install_git.sh +++ b/tests/p_git/0-install_git.sh @@ -5,7 +5,7 @@ t_Log "Running $0 - installing git" # Install git -if [ $centos_ver == '6' ] +if [ $centos_ver -ge 6 ] then t_InstallPackage git else diff --git a/tests/p_git/10-test_git.sh b/tests/p_git/10-test_git.sh index 719ea91..79ac9c3 100755 --- a/tests/p_git/10-test_git.sh +++ b/tests/p_git/10-test_git.sh @@ -6,7 +6,7 @@ t_Log "Running $0 - checking git installation" -if [ $centos_ver == '6' ] +if [ $centos_ver -ge 6 ] then git --version ret_val=$? diff --git a/tests/p_git/11-test_git_clone.sh b/tests/p_git/11-test_git_clone.sh index c748ecb..ff06766 100755 --- a/tests/p_git/11-test_git_clone.sh +++ b/tests/p_git/11-test_git_clone.sh @@ -5,7 +5,7 @@ t_Log "Running $0 - testing a local git clone operation" -if [ $centos_ver == '6' ] +if [ $centos_ver -ge 6 ] then # Testing Git clone by comparing SHAs workpath=$(pwd) @@ -18,6 +18,8 @@ if [ $centos_ver == '6' ] cd /tmp git clone $temp_repo cloned_repo cd cloned_repo + git config user.email "centos@centos.org" + git config user.name "t_functional tests" echo "hello world" > hello git add hello git commit -m "Temp commit" diff --git a/tests/p_git/12-test_git_log.sh b/tests/p_git/12-test_git_log.sh index 0c37264..22c4940 100755 --- a/tests/p_git/12-test_git_log.sh +++ b/tests/p_git/12-test_git_log.sh @@ -5,7 +5,7 @@ t_Log "Running $0 - testing git logging and commit messages" -if [ $centos_ver == '6' ] +if [ $centos_ver -ge 6 ] then # Testing git log and git commit msgs workpath=$(pwd) @@ -17,6 +17,8 @@ if [ $centos_ver == '6' ] cd /tmp git clone $temp_repo cloned_repo cd cloned_repo + git config user.email "centos@centos.org" + git config user.name "t_functional tests" echo "hello world" > hello git add hello git commit -m "Temp commit" 2>&1 diff --git a/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh b/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh index fece3c8..6304a31 100755 --- a/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh +++ b/tests/p_java-1.6.0-openjdk/0-install-openjdk.sh @@ -1,14 +1,8 @@ #!/bin/bash # Author: Christoph Galuschka -uname_arch=$(uname -m) - -if [ "$uname_arch" == "armv7l" ]; then - t_Log "*** Not testing on Arch: $uname_arch ***" - exit 0 -fi -# Install python -if (t_GetArch | grep -qE 'aarch64|armv7hl|ppc64le') +# Install java +if (t_GetArch | grep -qE 'aarch64|ppc64le') then echo "Package not included for current arch, skipping" exit 0 diff --git a/tests/p_java-1.6.0-openjdk/10-test_java.sh b/tests/p_java-1.6.0-openjdk/10-test_java.sh index fd02adf..a1c6e6f 100755 --- a/tests/p_java-1.6.0-openjdk/10-test_java.sh +++ b/tests/p_java-1.6.0-openjdk/10-test_java.sh @@ -1,14 +1,7 @@ #!/bin/sh # Author: Christoph Galuschka -uname_arch=$(uname -m) - -if [ "$uname_arch" == "armv7l" ]; then - t_Log "*** Not testing on Arch: $uname_arch ***" - exit 0 -fi - -if (t_GetArch | grep -qE 'aarch64|armv7hl|ppc64le') +if (t_GetArch | grep -qE 'aarch64|ppc64le') then echo "Package not included for current arch, skipping" exit 0 @@ -16,6 +9,10 @@ fi t_Log "Running $0 - javac can compile and java can print 'hello centos'" +# selecting the right alternative +t_Select_Alternative java jre-1.6.0-openjdk +t_Select_Alternative javac java-1.6.0-openjdk + # creating source file PATH2FILE='/var/tmp/' FILE='HelloWorld' diff --git a/tests/p_java-openjdk/0-install-openjdk.sh b/tests/p_java-openjdk/0-install-openjdk.sh new file mode 100755 index 0000000..ae14d92 --- /dev/null +++ b/tests/p_java-openjdk/0-install-openjdk.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Author: Pablo Greco +# Based on java-1.6.0-openjdk test from Christoph Galuschka + +. $(dirname "$0")/p_java-openjdk-common + +t_Log "Running $0 - installing openjdk runtime/development environment." + +for i in $JAVA_VERSIONS;do + t_InstallPackage java-$i-openjdk java-$i-openjdk-devel +done diff --git a/tests/p_java-openjdk/10-test_java.sh b/tests/p_java-openjdk/10-test_java.sh new file mode 100755 index 0000000..010014e --- /dev/null +++ b/tests/p_java-openjdk/10-test_java.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Author: Pablo Greco +# Based on java-1.6.0-openjdk test from Christoph Galuschka + +. $(dirname "$0")/p_java-openjdk-common + +for i in $JAVA_VERSIONS;do +t_Log "Running $0 - javac can compile and java can print 'hello centos'" + +# selecting the right alternative +t_Select_Alternative java "(jre|java)-$i-openjdk" +t_Select_Alternative javac "java-$i-openjdk" + +# creating source file +PATH2FILE='/var/tmp/' +FILE='HelloWorld' +FILE2=$PATH2FILE$FILE.java + +cat > $FILE2 < +# Based on java-1.6.0-openjdk test from Christoph Galuschka + +[ ${centos_ver} -lt 7 ] && { t_Log "Multiple java versions test is only available since el7, skipping tests..." ; exit ; } + +JAVA_VERSIONS="1.7.0 1.8.0 11" + +if (t_GetArch | grep -qvE 'aarch64|ppc64le') + then + JAVA_VERSIONS="1.6.0 $JAVA_VERSIONS" +fi + +[ -z "${JAVA_VERSIONS}" ] && { t_Log "No java versions to test, skipping tests..." ; exit ; } diff --git a/tests/p_lsb/0-install_redhat-lsb.sh b/tests/p_lsb/0-install_redhat-lsb.sh index 1c01bfd..a7e0b91 100755 --- a/tests/p_lsb/0-install_redhat-lsb.sh +++ b/tests/p_lsb/0-install_redhat-lsb.sh @@ -1,13 +1,5 @@ #!/bin/bash # Author: Athmane Madjoudj -uname_arch=$(uname -m) - -if [ "$uname_arch" == "armv7l" ]; then - t_Log "*** Not testing on Arch: $uname_arch ***" - exit 0 -fi - t_Log "$0 - Installing redhat-lsb" t_InstallPackage redhat-lsb - diff --git a/tests/p_lsb/lsb_release_brand_test.sh b/tests/p_lsb/lsb_release_brand_test.sh index 9ed6490..e3e73c5 100755 --- a/tests/p_lsb/lsb_release_brand_test.sh +++ b/tests/p_lsb/lsb_release_brand_test.sh @@ -1,16 +1,9 @@ #!/bin/sh # Author: Athmane Madjoudj -t_Log "Running $0 - LSB CentOS braning check." - -uname_arch=$(uname -m) - -if [ "$uname_arch" == "armv7l" ]; then - t_Log "*** Not testing on Arch: $uname_arch ***" - exit 0 -fi +t_Log "Running $0 - LSB CentOS branding check." lsb_release -i | grep -q "CentOS" && \ -lsb_release -d | grep -q "CentOS" +lsb_release -d | grep -q "CentOS" t_CheckExitStatus $? diff --git a/tests/p_openssh/sshd_user_login-with-key.sh b/tests/p_openssh/sshd_user_login-with-key.sh index d078b5e..b07a680 100755 --- a/tests/p_openssh/sshd_user_login-with-key.sh +++ b/tests/p_openssh/sshd_user_login-with-key.sh @@ -1,12 +1,5 @@ #!/bin/sh -uname_arch=$(uname -m) - -if [ "$uname_arch" == "armv7l" ]; then - t_Log "*** Not testing on Arch: $uname_arch ***" - exit 0 -fi - for KeyType in rsa dsa; do userdel -rf sshtest; useradd sshtest && echo sshtest | passwd --stdin sshtest runuser -l sshtest -c "echo | ssh-keygen -q -t ${KeyType} -b 1024 -f ~/.ssh/id_${KeyType}" > /dev/null diff --git a/tests/r_check_mod_packages/01_modpackages.sh b/tests/r_check_mod_packages/01_modpackages.sh index 42f4651..788aa06 100755 --- a/tests/r_check_mod_packages/01_modpackages.sh +++ b/tests/r_check_mod_packages/01_modpackages.sh @@ -7,18 +7,15 @@ uname_arch=$(uname -m) if [ $SKIP_QA_HARNESS -eq 1 ] && [ "$PRE_UPDATES" != "1" ] ; then t_Log "Skip $0 in non QA harness environment" ret_val=0 -elif [ "$uname_arch" == "armv7l" ] ; then - t_Log "*** Not testing $0 on Arch: $uname_arch ***" - ret_val=0 else ret_val=0 if [ "$centos_ver" = "7" ] ; then - + t_Log "Running $0 - Checking current repositories for .el7.centos on modified files" uname_arch=$(uname -m) yum clean all - for pkg in $(cat tests/r_check_mod_packages/c72-mod-packages.lst.$uname_arch) - do + for pkg in $(cat tests/r_check_mod_packages/c72-mod-packages.lst.$uname_arch|grep -v '^#') + do has_centos=$(yum list $pkg | grep '.el7.centos') if [ "$has_centos" == "" ]; then echo $pkg missing .el7.centos diff --git a/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l b/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l index ca9632c..e9835d1 100644 --- a/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l +++ b/tests/r_check_mod_packages/c72-mod-packages.lst.armv7l @@ -5,30 +5,28 @@ anaconda basesystem centos-indexhtml centos-logos -centos-release -compat-glibc +centos-userland-release +#compat-glibc (not available in armhfp) dhcp firefox -grub2 +#grub2 (not available yet in armhfp) httpd initial-setup ipa-client -kabi-yum-plugins +#kabi-yum-plugins (not available in armhfp) kde-settings libreport ntp -openssl098e +#openssl098e (not available in armhfp) pcs plymouth redhat-rpm-config redhat-lsb scap-security-guide -shim-unsigned-ia32 -shim-unsigned-x64 sos subscription-manager system-config-date system-config-kdump thunderbird -xulrunner +#xulrunner (currently has the wrong disttag, will be fixed on the next update) yum