Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add derby tests to the set of External Tests running at Adopt #400

Merged
merged 1 commit into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
73 changes: 73 additions & 0 deletions thirdparty_containers/derby/dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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 \
apt-transport-https \
ca-certificates \
dirmngr \
curl \
git \
make \
unzip \
vim \
tar \
wget

# Installs Ant 1.10.2 as required by Derby
ENV ANT_VERSION 1.10.2
ENV ANT_HOME=/opt/ant
RUN wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \
&& wget --no-check-certificate --no-cookies http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz.md5 \
&& echo "$(cat apache-ant-${ANT_VERSION}-bin.tar.gz.md5) apache-ant-${ANT_VERSION}-bin.tar.gz" | md5sum -c \
&& tar -zvxf apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt/ \
&& ln -s /opt/apache-ant-${ANT_VERSION} /opt/ant \
&& rm -f apache-ant-${ANT_VERSION}-bin.tar.gz \
&& rm -f apache-ant-${ANT_VERSION}-bin.tar.gz.md5
RUN update-alternatives --install "/usr/bin/ant" "ant" "/opt/ant/bin/ant" 1 && \
update-alternatives --set "ant" "/opt/ant/bin/ant"

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", "/derby-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

30 changes: 30 additions & 0 deletions thirdparty_containers/derby/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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>SE90</subset>
</subsets>
<levels>
<level>extended</level>
</levels>
<groups>
<group>external</group>
</groups>
</test>
</playlist>