The test suite we use to indicate functional acceptance of a machine instance
Pablo Greco
2019-01-02 8614a03afd4902f0471e0534cd543176d1ae2257
Add test for all java versions
3 files added
71 ■■■■■ changed files
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_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 ; }