From 8614a03afd4902f0471e0534cd543176d1ae2257 Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: Jan 02 2019 11:02:10 +0000 Subject: Add test for all java versions --- 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 ; }