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

Dockerized End-To-End Tests (Proof of Concept) #97

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add Docker Compose file (cfs/gsw orchestration) as well as platforms …
…and gsw Dockerfiles
  • Loading branch information
lethuillierg committed Jun 4, 2020
commit 45df3847368030d1543811919345d4ece1837e48
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Makefile
build/
sample_defs/
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '2'

services:
cfs:
build:
context: ./
dockerfile: ./tools/e2eTests/platforms/Ubuntu/18.04/Dockerfile
args:
- ENABLE_UNIT_TESTS=false
- SIMULATION=native
- BUILDTYPE=debug
- OMIT_DEPRECATED=true
cap_add:
- CAP_SYS_RESOURCE
networks:
- default
depends_on:
- gsw

gsw:
build:
context: ./
dockerfile: ./tools/e2eTests/gsw/Dockerfile
networks:
- default

networks:
default:
internal: true
11 changes: 11 additions & 0 deletions tools/e2eTests/gsw/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.7.7-alpine3.11

ENV PYTHONUNBUFFERED=1

WORKDIR /test_runner

COPY tools/e2eTests/gsw/gsw.py gsw.py

RUN chmod +x gsw.py

ENTRYPOINT [ "./gsw.py" ]
53 changes: 53 additions & 0 deletions tools/e2eTests/platforms/Alpine/3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Warning: This image is currently not operational

FROM alpine:3.11 AS builder

ARG ENABLE_UNIT_TESTS
ENV ENABLE_UNIT_TESTS=${ENABLE_UNIT_TESTS}

ARG SIMULATION
ENV SIMULATION=${SIMULATION}

ARG BUILDTYPE
ENV BUILDTYPE=${BUILDTYPE}

ARG OMIT_DEPRECATED
ENV OMIT_DEPRECATED=${OMIT_DEPRECATED}

RUN echo http:https://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories

RUN set -ex && \
apk add --update --no-cache \
make=4.2.1-r2 \
cmake=3.15.5-r0 \
git=2.24.3-r0 \
gcc=9.2.0-r4 \
g++=9.2.0-r4

RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; \
then { echo http:https://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --update --no-cache lcov=1.14-r0; } fi

WORKDIR /cFS

COPY . .

RUN git submodule init \
&& git submodule update \
&& cp cfe/cmake/Makefile.sample Makefile \
&& cp -r cfe/cmake/sample_defs .

RUN make prep
RUN make
RUN make install
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { ( make test | grep 'Failed' ) && ( make lcov | grep '%' ); } fi
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { cat ./build/native/Testing/Temporary/LastTest.log | grep 'FAIL' | grep -v 'FAIL::0'; } fi


FROM alpine:3.11

COPY --from=builder /cFS/build /cFS/build

WORKDIR /cFS/build/exe/cpu1

CMD [ "./core-cpu1" ]
51 changes: 51 additions & 0 deletions tools/e2eTests/platforms/CentOS/7/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM centos:7 AS builder

ARG LCOV_VERSION=1.13-1.el7

ARG ENABLE_UNIT_TESTS
ENV ENABLE_UNIT_TESTS=${ENABLE_UNIT_TESTS}

ARG SIMULATION
ENV SIMULATION=${SIMULATION}

ARG BUILDTYPE
ENV BUILDTYPE=${BUILDTYPE}

ARG OMIT_DEPRECATED
ENV OMIT_DEPRECATED=${OMIT_DEPRECATED}

RUN yum -y -q update \
&& yum -y install \
git-1.8.3.1-21.el7_7.x86_64 \
cmake-2.8.12.2-2.el7.x86_64 \
make-3.82-24.el7.x86_64 \
gcc-4.8.5-39.el7.x86_64

RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; \
then { curl https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/lcov-${LCOV_VERSION}.noarch.rpm \
-o lcov-${LCOV_VERSION}.noarch.rpm \
&& yum -y install lcov-${LCOV_VERSION}.noarch.rpm; } fi

WORKDIR /cFS

COPY . .

RUN git submodule init \
&& git submodule update \
&& cp cfe/cmake/Makefile.sample Makefile \
&& cp -r cfe/cmake/sample_defs .

RUN make prep
RUN make
RUN make install
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { ( make test | grep 'Failed' ) && ( make lcov | grep '%' ); } fi
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { cat ./build/native/Testing/Temporary/LastTest.log | grep 'FAIL' | grep -v 'FAIL::0'; } fi


FROM centos:7

COPY --from=builder /cFS/build /cFS/build

WORKDIR /cFS/build/exe/cpu1

CMD [ "./core-cpu1" ]
54 changes: 54 additions & 0 deletions tools/e2eTests/platforms/Ubuntu/18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM ubuntu:18.04 AS builder

ARG DEBIAN_FRONTEND=noninteractive

ARG LCOV_VERSION=1.13-3

ARG ENABLE_UNIT_TESTS
ENV ENABLE_UNIT_TESTS=${ENABLE_UNIT_TESTS}

ARG SIMULATION
ENV SIMULATION=${SIMULATION}

ARG BUILDTYPE
ENV BUILDTYPE=${BUILDTYPE}

ARG OMIT_DEPRECATED
ENV OMIT_DEPRECATED=${OMIT_DEPRECATED}

RUN apt-get -qy update \
&& apt-get -y install --no-install-recommends \
ca-certificates=20190110~18.04.1 \
git=1:2.17.1-1ubuntu0.7 \
cmake=3.10.2-1ubuntu2.18.04.1 \
make=4.1-9.1ubuntu1 \
gcc=4:7.4.0-1ubuntu2.3 \
g++=4:7.4.0-1ubuntu2.3 \
&& rm -rf /var/lib/apt/lists/*

# Optional: Install lcov
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { apt-get -qy update && apt-get -y install lcov=${LCOV_VERSION}; } fi

WORKDIR /cFS

COPY . .

RUN git submodule init \
&& git submodule update \
&& cp cfe/cmake/Makefile.sample Makefile \
&& cp -r cfe/cmake/sample_defs .

RUN make prep
RUN make
RUN make install
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { ( make test | grep 'Failed' ) && ( make lcov | grep '%' ); } fi
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { cat ./build/native/Testing/Temporary/LastTest.log | grep 'FAIL' | grep -v 'FAIL::0'; } fi


FROM ubuntu:18.04

COPY --from=builder /cFS/build /cFS/build

WORKDIR /cFS/build/exe/cpu1

ENTRYPOINT [ "./core-cpu1" ]
59 changes: 59 additions & 0 deletions tools/e2eTests/platforms/Ubuntu/20.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
FROM ubuntu:20.04 AS builder

ARG DEBIAN_FRONTEND=noninteractive

ARG LCOV_VERSION=1.14-2

ARG ENABLE_UNIT_TESTS
ENV ENABLE_UNIT_TESTS=${ENABLE_UNIT_TESTS}

ARG SIMULATION
ENV SIMULATION=${SIMULATION}

ARG BUILDTYPE
ENV BUILDTYPE=${BUILDTYPE}

ARG OMIT_DEPRECATED
ENV OMIT_DEPRECATED=${OMIT_DEPRECATED}

RUN apt-get -qy update \
&& apt-get -y install \
ca-certificates=20190110ubuntu1.1 \
git=1:2.25.1-1ubuntu3 \
cmake=3.16.3-1ubuntu1 \
make=4.2.1-1.2 \
gcc=4:9.3.0-1ubuntu2 \
g++=4:9.3.0-1ubuntu2 \
&& rm -rf /var/lib/apt/lists/*

# Optional: Install lcov
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; \
then { apt-get update && \
apt-get -y install software-properties-common=0.98.9 && \
add-apt-repository ppa:ubuntu-toolchain-r/test && \
apt-get -qy update && \
apt-get -y install lcov=${LCOV_VERSION}; } fi

WORKDIR /cFS

COPY . .

RUN git submodule init \
&& git submodule update \
&& cp cfe/cmake/Makefile.sample Makefile \
&& cp -r cfe/cmake/sample_defs .

RUN make prep
RUN make
RUN make install
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { ( make test | grep 'Failed' ) && ( make lcov | grep '%' ); } fi
RUN if [ "${ENABLE_UNIT_TESTS}" = true ]; then { cat ./build/native/Testing/Temporary/LastTest.log | grep 'FAIL' | grep -v 'FAIL::0'; } fi


FROM ubuntu:20.04

COPY --from=builder /cFS/build /cFS/build

WORKDIR /cFS/build/exe/cpu1

ENTRYPOINT [ "./core-cpu1" ]