Alter Dockerfiles to include common.go and use a prebuilt JDK.

After the refactoring of the proctor binaries, the Dockerfiles for each
language must be altered to copy the common folder into their image.
Additionally, Java has been changed to use the pre-built version of
JDK-11 from Ubuntu, instead of building it from the source.  This allows
for a smaller image and faster test execution within the container.

PiperOrigin-RevId: 261805158
This commit is contained in:
Samantha Sample 2019-08-05 17:18:51 -07:00 committed by gVisor bot
parent 23e740433d
commit fb996668e4
7 changed files with 27 additions and 37 deletions

View File

@ -16,7 +16,7 @@ The following runtimes are currently supported:
1) [Install and configure Docker](https://docs.docker.com/install/) 1) [Install and configure Docker](https://docs.docker.com/install/)
2) Build each Docker container: 2) Build each Docker container from the runtimes directory:
```bash ```bash
$ docker build -f $LANG/Dockerfile [-t $NAME] . $ docker build -f $LANG/Dockerfile [-t $NAME] .

View File

@ -23,9 +23,12 @@ ENV LANG_DIR=${GOROOT}
WORKDIR ${LANG_DIR}/src WORKDIR ${LANG_DIR}/src
RUN ./make.bash RUN ./make.bash
# Pre-compile the tests for faster execution
RUN ["/root/go/bin/go", "tool", "dist", "test", "-compile-only"]
WORKDIR ${LANG_DIR} WORKDIR ${LANG_DIR}
COPY proctor-go.go ${LANG_DIR} COPY common /root/go/src/gvisor.dev/gvisor/test/runtimes/common/common
COPY go/proctor-go.go ${LANG_DIR}
ENTRYPOINT ["/root/go/bin/go", "run", "proctor-go.go"] ENTRYPOINT ["/root/go/bin/go", "run", "proctor-go.go"]

View File

@ -1,25 +1,16 @@
FROM ubuntu:bionic FROM ubuntu:bionic
# This hash is associated with a specific JDK release and needed for ensuring # This hash is associated with a specific JDK release and needed for ensuring
# the same version is downloaded every time. # the same version is downloaded every time.
ENV LANG_HASH=af47e0398606 ENV LANG_HASH=76072a077ee1
ENV LANG_VER=11u-dev ENV LANG_VER=11
ENV LANG_NAME=Java ENV LANG_NAME=Java
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
autoconf \ autoconf \
build-essential \ build-essential \
curl\ curl \
file \
libasound2-dev \
libcups2-dev \
libfontconfig1-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxrender-dev \
libxt-dev \
libxtst-dev \
make \ make \
openjdk-${LANG_VER}-jdk \
unzip \ unzip \
zip zip
@ -27,26 +18,18 @@ WORKDIR /root
RUN curl -o go.tar.gz https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz RUN curl -o go.tar.gz https://dl.google.com/go/go1.12.6.linux-amd64.tar.gz
RUN tar -zxf go.tar.gz RUN tar -zxf go.tar.gz
# Use curl instead of ADD to prevent redownload every time. # Download the JDK test library.
RUN curl -o jdk.tar.gz http://hg.openjdk.java.net/jdk-updates/jdk${LANG_VER}/archive/${LANG_HASH}.tar.gz RUN set -ex \
# Download Java version N-1 to be used as the Boot JDK to build Java version N. && curl -fsSL --retry 10 -o /tmp/jdktests.tar.gz http://hg.openjdk.java.net/jdk/jdk${LANG_VER}/archive/${LANG_HASH}.tar.gz/test \
RUN curl -o bootjdk.tar.gz https://download.java.net/openjdk/jdk10/ri/openjdk-10+44_linux-x64_bin_ri.tar.gz && tar -xzf /tmp/jdktests.tar.gz -C /root \
&& rm -f /tmp/jdktests.tar.gz
RUN tar -zxf jdk.tar.gz
RUN tar -zxf bootjdk.tar.gz
# Specify the JDK to be used by jtreg.
ENV JT_JAVA=/root/jdk${LANG_VER}-${LANG_HASH}/build/linux-x86_64-normal-server-release/jdk
ENV LANG_DIR=/root/jdk${LANG_VER}-${LANG_HASH}
WORKDIR ${LANG_DIR}
RUN curl -o jtreg.tar.gz https://ci.adoptopenjdk.net/view/Dependencies/job/jtreg/lastSuccessfulBuild/artifact/jtreg-4.2.0-tip.tar.gz RUN curl -o jtreg.tar.gz https://ci.adoptopenjdk.net/view/Dependencies/job/jtreg/lastSuccessfulBuild/artifact/jtreg-4.2.0-tip.tar.gz
RUN tar -xzf jtreg.tar.gz RUN tar -xzf jtreg.tar.gz
RUN bash configure --with-boot-jdk=/root/jdk-10 --with-jtreg=${LANG_DIR}/jtreg
RUN make clean
RUN make images
COPY proctor-java.go ${LANG_DIR} ENV LANG_DIR=/root
COPY common /root/go/src/gvisor.dev/gvisor/test/runtimes/common/common
COPY java/proctor-java.go ${LANG_DIR}
ENTRYPOINT ["/root/go/bin/go", "run", "proctor-java.go"] ENTRYPOINT ["/root/go/bin/go", "run", "proctor-java.go"]

View File

@ -29,6 +29,7 @@ import (
var ( var (
dir = os.Getenv("LANG_DIR") dir = os.Getenv("LANG_DIR")
hash = os.Getenv("LANG_HASH")
jtreg = filepath.Join(dir, "jtreg/bin/jtreg") jtreg = filepath.Join(dir, "jtreg/bin/jtreg")
exclDirs = regexp.MustCompile(`(^(sun\/security)|(java\/util\/stream)|(java\/time)| )`) exclDirs = regexp.MustCompile(`(^(sun\/security)|(java\/util\/stream)|(java\/time)| )`)
) )
@ -44,7 +45,7 @@ func main() {
func (j javaRunner) ListTests() ([]string, error) { func (j javaRunner) ListTests() ([]string, error) {
args := []string{ args := []string{
"-dir:test/jdk", "-dir:/root/jdk11-" + hash + "/test/jdk",
"-ignore:quiet", "-ignore:quiet",
"-a", "-a",
"-listtests", "-listtests",
@ -69,7 +70,7 @@ func (j javaRunner) ListTests() ([]string, error) {
} }
func (j javaRunner) RunTest(test string) error { func (j javaRunner) RunTest(test string) error {
args := []string{"-dir:test/jdk/", test} args := []string{"-noreport", "-dir:/root/jdk11-" + hash + "/test/jdk", test}
cmd := exec.Command(jtreg, args...) cmd := exec.Command(jtreg, args...)
cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {

View File

@ -22,7 +22,8 @@ RUN ./configure
RUN make RUN make
RUN make test-build RUN make test-build
COPY proctor-nodejs.go ${LANG_DIR} COPY common /root/go/src/gvisor.dev/gvisor/test/runtimes/common/common
COPY nodejs/proctor-nodejs.go ${LANG_DIR}
# Including dumb-init emulates the Linux "init" process, preventing the failure # Including dumb-init emulates the Linux "init" process, preventing the failure
# of tests involving worker processes. # of tests involving worker processes.

View File

@ -24,6 +24,7 @@ WORKDIR ${LANG_DIR}
RUN ./configure RUN ./configure
RUN make RUN make
COPY proctor-php.go ${LANG_DIR} COPY common /root/go/src/gvisor.dev/gvisor/test/runtimes/common/common
COPY php/proctor-php.go ${LANG_DIR}
ENTRYPOINT ["/root/go/bin/go", "run", "proctor-php.go"] ENTRYPOINT ["/root/go/bin/go", "run", "proctor-php.go"]

View File

@ -26,6 +26,7 @@ WORKDIR ${LANG_DIR}
RUN ./configure --with-pydebug RUN ./configure --with-pydebug
RUN make -s -j2 RUN make -s -j2
COPY proctor-python.go ${LANG_DIR} COPY common /root/go/src/gvisor.dev/gvisor/test/runtimes/common/common
COPY python/proctor-python.go ${LANG_DIR}
ENTRYPOINT ["/root/go/bin/go", "run", "proctor-python.go"] ENTRYPOINT ["/root/go/bin/go", "run", "proctor-python.go"]