Skip to content

Commit

Permalink
Add derby tests to the set of External Tests running at Adopt
Browse files Browse the repository at this point in the history
Signed-off-by: Mesbah Alam <Mesbah_Alam@ca.ibm.com>
  • Loading branch information
Mesbah-Alam committed Apr 26, 2018
1 parent da5e4f3 commit aa76c9e
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 0 deletions.
39 changes: 39 additions & 0 deletions thirdparty_containers/derby/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<project name="Derby-Test" default="build" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<description>
Build derby-test docker image
</description>

<!-- set properties for this build -->
<property name="DEST" value="${BUILD_ROOT}/thirdparty_containers/derby-test" />
<property name="dist" location="${DEST}/${JAVA_VERSION}" />
<property name="src" location="." />
<property name="jvm_version" location="${JVM_VERSION}" />

<target name="init">
<mkdir dir="${dist}"/>
</target>

<target name="clean_image" depends="init" description="clean derby test docker image if there is one">
<exec executable="docker">
<arg line="rmi -f adoptopenjdk-derby-test" />
</exec>
</target>

<target name="build_image" depends="clean_image" description="build derby test docker image">
<exec executable="docker" failonerror="true">
<arg line="build -t adoptopenjdk-derby-test -f dockerfile/Dockerfile --pull . --build-arg SDK=${JVM_VERSION}" />
</exec>
</target>

<target name="dist" depends="build_image" description="generate the distribution">
<copy todir="${DEST}">
<fileset dir="${src}" includes="*.xml, *.mk"/>
</copy>
</target>

<target name="build">
<antcall target="dist" inheritall="true" />
</target>
</project>
60 changes: 60 additions & 0 deletions thirdparty_containers/derby/dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This Dockerfile in thirdparty_containers/derby/dockerfile dir is used to create an image with
# AdoptOpenJDK jdk binary installed. Basic test dependent executions
# are installed during the building process.
#
# Build example: `docker build -t adoptopenjdk-derby-test .`
#
# This Dockerfile builds image based on adoptopenjdk/openjdk8:latest.
# If you want to build image based on other images, please use
# `--build-arg list` to specify your base image
#
# Build example: `docker build --build-arg IMAGE_NAME=<image_name> --build-arg IMAGE_VERSION=<image_version >-t adoptopenjdk-derby-test .`

ARG SDK=openjdk8
ARG IMAGE_NAME=adoptopenjdk/$SDK
ARG IMAGE_VERSION=latest

FROM $IMAGE_NAME:$IMAGE_VERSION

# Install test dependent executable files
RUN apt-get update \
&& apt-get -y install \
ant \
apt-transport-https \
ca-certificates \
dirmngr \
curl \
git \
make \
unzip \
vim \
wget

VOLUME ["/java"]
ENV JAVA_HOME=/java \
PATH=/java/bin:$PATH \
JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

WORKDIR /
ENV DERBY_HOME ${WORKDIR}/derby

# This is the main script to run derby tests.
COPY ./dockerfile/derby-test.sh /derby-test.sh

# Clone Derby source.
RUN git clone https://github.com/apache/derby.git

ENTRYPOINT ["/bin/bash", "/example-test.sh"]
CMD ["--version"]
72 changes: 72 additions & 0 deletions thirdparty_containers/derby/dockerfile/derby-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#Set up Java to be used by the the derby-test

if [ -d /java/jre/bin ];then
echo "Using mounted Java8"
export JAVA_BIN=/java/jre/bin
export JAVA_HOME=/java
export PATH=$JAVA_BIN:$PATH
java -version
elif [ -d /java/bin ]; then
echo "Using mounted Java9"
export JAVA_BIN=/java/bin
export JAVA_HOME=/java
export PATH=$JAVA_BIN:$PATH
java -version
else
echo "Using docker image default Java"
java_path=$(type -p java)
suffix="/java"
java_root=${java_path%$suffix}
export JAVA_BIN="$java_root"
echo "JAVA_BIN is: $JAVA_BIN"
$JAVA_BIN/java -version
fi

TEST_SUITE=$1

echo "PATH is : $PATH"
echo "JAVA_HOME is : $JAVA_HOME"
echo "type -p java is :"
type -p java
echo "java -version is: \n"
java -version

cd ${DERBY_HOME}
ls .
pwd

#clean previous build artifacts
ant -f ${DERBY_HOME}/build.xml clobber

#build all
ant -f ${DERBY_HOME}/build.xml all

#create jars
ant -f ${DERBY_HOME}/build.xml buildjars

export jardir ${DERBY_HOME}/jars/sane
export tstjardir ${DERBY_HOME}/tools/java
export CLASSPATH "${jardir}/derbyrun.jar:${jardir}/derbyTesting.jar:${tstjardir}/junit.jar"

java -jar ${DERBY_HOME}/jars/sane/derbyrun.jar sysinfo

#Run all tests
ant -Dderby.tests.basePort=1690 -Dderby.system.durability=test -DderbyTesting.oldReleasePath=${DERBY_HOME}/jars junit-all

#Run only derbylang suite
#java -Dverbose=true -cp ${jardir}/derbyrun.jar:${jardir}/derbyTesting.jar:$tstjardir/junit.jar org.apache.derbyTesting.functionTests.harness.RunSuite #derbylang

31 changes: 31 additions & 0 deletions thirdparty_containers/derby/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../TestConfig/playlist.xsd">
<test>
<testCaseName>derby_test_junit_all</testCaseName>
<command>docker run --rm -v $(JDK_HOME):/java adoptopenjdk-derby-test:latest ; \
$(TEST_STATUS)</command>
<subsets>
<subset>SE80</subset>
<subset>SE90</subset>
</subsets>
<levels>
<level>extended</level>
</levels>
<groups>
<group>external</group>
</groups>
</test>
</playlist>

0 comments on commit aa76c9e

Please sign in to comment.