The test suite we use to indicate functional acceptance of a machine instance
Johnny Hughes
2019-01-03 cfef41660d09596754960473e320e52134eff928
Merge pull request #31 from psgreco/devel

Fix tests for armhfp and different java versions
3 files added
13 files modified
176 ■■■■■ changed files
tests/0_lib/functions.sh 13 ●●●●● patch | view | raw | blame | history
tests/p_diffutils/10-cmp-tests 8 ●●●●● patch | view | raw | blame | history
tests/p_git/0-install_git.sh 2 ●●● patch | view | raw | blame | history
tests/p_git/10-test_git.sh 2 ●●● patch | view | raw | blame | history
tests/p_git/11-test_git_clone.sh 4 ●●● patch | view | raw | blame | history
tests/p_git/12-test_git_log.sh 4 ●●● patch | view | raw | blame | history
tests/p_java-1.6.0-openjdk/0-install-openjdk.sh 10 ●●●● patch | view | raw | blame | history
tests/p_java-1.6.0-openjdk/10-test_java.sh 13 ●●●●● patch | view | raw | blame | history
tests/p_java-openjdk/0-install-openjdk.sh 11 ●●●●● patch | view | raw | blame | history
tests/p_java-openjdk/10-test_java.sh 46 ●●●●● patch | view | raw | blame | history
tests/p_java-openjdk/p_java-openjdk-common 14 ●●●●● patch | view | raw | blame | history
tests/p_lsb/0-install_redhat-lsb.sh 8 ●●●●● patch | view | raw | blame | history
tests/p_lsb/lsb_release_brand_test.sh 11 ●●●● patch | view | raw | blame | history
tests/p_openssh/sshd_user_login-with-key.sh 7 ●●●●● patch | view | raw | blame | history
tests/r_check_mod_packages/01_modpackages.sh 9 ●●●●● patch | view | raw | blame | history
tests/r_check_mod_packages/c72-mod-packages.lst.armv7l 14 ●●●●● patch | view | raw | blame | history
tests/0_lib/functions.sh
@@ -142,6 +142,18 @@
 [ $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_CheckForPort
export -f t_Assert
export -f t_Assert_Equals
export -f t_Select_Alternative
export centos_ver
export arch
tests/p_diffutils/10-cmp-tests
@@ -1,14 +1,6 @@
#!/bin/bash
# Author: Iain Douglas <centos@1n6.org.uk>
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 {
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
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=$?
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 @@
  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"
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 @@
  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
tests/p_java-1.6.0-openjdk/0-install-openjdk.sh
@@ -1,14 +1,8 @@
#!/bin/bash
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
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
tests/p_java-1.6.0-openjdk/10-test_java.sh
@@ -1,14 +1,7 @@
#!/bin/sh
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
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 @@
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'
tests/p_java-openjdk/0-install-openjdk.sh
New file
@@ -0,0 +1,11 @@
#!/bin/bash
# Author: Pablo Greco <pablo@fliagreco.com.ar>
# Based on java-1.6.0-openjdk test from Christoph Galuschka <christoph.galuschka@chello.at>
. $(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
tests/p_java-openjdk/10-test_java.sh
New file
@@ -0,0 +1,46 @@
#!/bin/bash
# Author: Pablo Greco <pablo@fliagreco.com.ar>
# Based on java-1.6.0-openjdk test from Christoph Galuschka <christoph.galuschka@chello.at>
. $(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 <<EOF
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("hello centos");
  }
}
EOF
# Compiling
javac $FILE2
if [ $? == 1 ]
  then
  t_Log "Java-Compilation failed"
  exit
fi
# executing java
workpath=$(pwd)
cd $PATH2FILE
java $FILE |grep -q 'hello centos'
t_CheckExitStatus $?
cd $workpath
# remove files
/bin/rm $PATH2FILE$FILE.class $FILE2
done
tests/p_java-openjdk/p_java-openjdk-common
New file
@@ -0,0 +1,14 @@
#!/bin/bash
# Author: Pablo Greco <pablo@fliagreco.com.ar>
# Based on java-1.6.0-openjdk test from Christoph Galuschka <christoph.galuschka@chello.at>
[ ${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 ; }
tests/p_lsb/0-install_redhat-lsb.sh
@@ -1,13 +1,5 @@
#!/bin/bash
# Author: Athmane Madjoudj <athmanem@gmail.com>
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
tests/p_lsb/lsb_release_brand_test.sh
@@ -1,16 +1,9 @@
#!/bin/sh
# Author: Athmane Madjoudj <athmanem@gmail.com>
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 $?
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
tests/r_check_mod_packages/01_modpackages.sh
@@ -7,18 +7,15 @@
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
tests/r_check_mod_packages/c72-mod-packages.lst.armv7l
@@ -5,30 +5,28 @@
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