From 990e3f61fe5496b5b5469649cef8de93fa845ecd Mon Sep 17 00:00:00 2001 From: Thirsty2 Date: Sat, 3 Oct 2020 14:53:20 -0700 Subject: [PATCH] Updated Dockerfiles to run regression tests during build. --- Dockerfile | 53 ++++++++++++++++++++++++---------------- Dockerfile.ubuntu1804 | 56 ++++++++++++++++++++++++++----------------- 2 files changed, 66 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 947a68837..9d4526060 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,13 +37,14 @@ RUN sh autoconf.sh && \ FROM builder as test-builder -# WORKDIR /iverilog RUN make check -FROM base as release-candidate +FROM base as test-release-candidate COPY --from=builder /usr/local /usr/local/ +FROM test-release-candidate as release-candidate + RUN adduser --disabled-password ic USER ic WORKDIR /home/ic @@ -56,19 +57,34 @@ ENTRYPOINT [ "make" ] # image before it is finally released. A failure here would stop the process so that # a faulty image is not released. # -# The make and make clean lines below fail if iverilog/dockerfiles/test isn't available -# and older release branches like v10_3 do not have this directory, so we need a -# layer that does have it to copy from. We create that layer as test-branch here: -# FROM builder as test-branch -# WORKDIR /iverilog -# ARG TEST_BRANCH=master -# RUN git checkout ${TEST_BRANCH} -# -# FROM release-candidate-entrypoint-make as test-release-candidate-entrypoint-make -# COPY --from=test-branch /iverilog/dockerfiles/test /home/ic/ -# -# RUN make -# RUN make clean +# We create a layer that contains the tests as builder-iverilog-regression-test here: + +FROM builder as builder-iverilog-regression-test-base + +ARG REGRESSION_TEST_URL=https://github.com/steveicarus/ivtest.git +RUN git clone ${REGRESSION_TEST_URL} ivtest + +FROM builder-iverilog-regression-test-base as builder-iverilog-regression-test + +WORKDIR ivtest +RUN perl vvp_reg.pl +RUN perl vpi_reg.pl + +FROM test-release-candidate as test-release-candidate-perl + +RUN apk add --no-cache \ + musl \ + perl + +RUN adduser --disabled-password ic +USER ic +WORKDIR /home/ic + +COPY --from=builder-iverilog-regression-test-base /ivtest /home/ic/ + +RUN perl vvp_reg.pl +# RUN perl vpi_reg.pl +# RUN perl vhdl_reg.pl FROM release-candidate-entrypoint-make as iverilog-make @@ -76,11 +92,6 @@ FROM release-candidate as iverilog # Below are some sample commands to build docker images. # -# The following builds iverilog from the source in the current directory # docker build . -t iverilog # -# The following builds the latest code from the Thirsty2/iverilog fork master branch -# docker build --build-arg IVERILOG_REPO_URL=https://github.com/Thirsty2/iverilog.git --build-arg TEST_BRANCH=add-dockerfile . -t iverilog -# -# The following won't work until the pull request is accepted, but should work afterwards to build the master branch of steveicarus/iverilog -# docker build . -t iverilog +# docker build --target iverilog-make . -t iverilog-make \ No newline at end of file diff --git a/Dockerfile.ubuntu1804 b/Dockerfile.ubuntu1804 index d3f110350..396f9d59b 100644 --- a/Dockerfile.ubuntu1804 +++ b/Dockerfile.ubuntu1804 @@ -35,13 +35,14 @@ RUN bash autoconf.sh && \ FROM builder as test-builder -# WORKDIR /iverilog RUN make check -FROM base as release-candidate +FROM base as test-release-candidate COPY --from=builder /usr/local /usr/local/ +FROM test-release-candidate as release-candidate + RUN adduser --disabled-password ic USER ic WORKDIR /home/ic @@ -54,19 +55,34 @@ ENTRYPOINT [ "make" ] # image before it is finally released. A failure here would stop the process so that # a faulty image is not released. # -# The make and make clean lines below fail if iverilog/dockerfiles/test isn't available -# and older release branches like v10_3 do not have this directory, so we need a -# layer that does have it to copy from. We create that layer as test-branch here: -# FROM builder as test-branch -# WORKDIR /iverilog -# ARG TEST_BRANCH=master -# RUN git checkout ${TEST_BRANCH} -# -# FROM release-candidate-entrypoint-make as test-release-candidate-entrypoint-make -# COPY --from=test-branch /iverilog/dockerfiles/test /home/ic/ -# -# RUN make -# RUN make clean +# We create a layer that contains the tests as builder-iverilog-regression-test here: + +FROM builder as builder-iverilog-regression-test-base + +ARG REGRESSION_TEST_URL=https://github.com/steveicarus/ivtest.git +RUN git clone ${REGRESSION_TEST_URL} ivtest + +FROM builder-iverilog-regression-test-base as builder-iverilog-regression-test + +WORKDIR ivtest +RUN perl vvp_reg.pl +RUN perl vpi_reg.pl + +FROM test-release-candidate as test-release-candidate-perl + +RUN apt-get update && \ + apt-get install -y \ + perl + +RUN adduser --disabled-password ic +USER ic +WORKDIR /home/ic + +COPY --from=builder-iverilog-regression-test-base /ivtest /home/ic/ + +RUN perl vvp_reg.pl +# RUN perl vpi_reg.pl +# RUN perl vhdl_reg.pl FROM release-candidate-entrypoint-make as iverilog-make @@ -74,11 +90,7 @@ FROM release-candidate as iverilog # Below are some sample commands to build docker images. # -# The following builds iverilog from the source in the current directory -# docker build . -t iverilog +# docker build -f Dockerfile.ubuntu1804 . -t iverilog # -# The following builds the latest code from the Thirsty2/iverilog fork master branch -# docker build --build-arg IVERILOG_REPO_URL=https://github.com/Thirsty2/iverilog.git --build-arg TEST_BRANCH=add-dockerfile . -t iverilog -# -# The following won't work until the pull request is accepted, but should work afterwards to build the master branch of steveicarus/iverilog -# docker build . -t iverilog +# docker build -f Dockerfile.ubuntu1804 --target iverilog-make . -t iverilog-make +