Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
jsmn
68 changes: 68 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# syntax=docker/dockerfile:1.6.0
FROM ubuntu:22.04 as build

# github action workflow step: Install dependencies
RUN <<EOF
apt-get update
# dependencies already installed in the github action ubuntu-latest base
# image - we need to install them here separately
apt-get install --no-install-recommends -y \
ca-certificates \
git \
build-essential \
cmake
# dependencies from github action workflow
apt-get install --no-install-recommends -y \
clang-tools \
libcmocka-dev \
libhttp-parser-dev \
libmbedtls-dev \
lcov
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF

WORKDIR /cmender
COPY CMakeLists.txt /cmender
COPY cmake cmake/
COPY include include/
COPY src src/
COPY platform platform/
COPY tests tests/

# github action workflow step: Install jsmn
RUN <<EOF
git clone https://github.com/zserge/jsmn.git
make -C jsmn
EOF
ENV CFLAGS="$CFLAGS -isystem /cmender/jsmn"
ENV LDFLAGS="$LDFLAGS -L/cmender/jsmn"

# github action workflow step: Compile
RUN <<EOF
mkdir build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTING=ON -DCODE_COVERAGE=ON
make -C build
EOF

# github action workflow step: Test
RUN <<EOF
make -C build test ARGS="-V"
make -C build test_coverage
EOF

# minimal image with test_tool
FROM scratch
WORKDIR /lib64
COPY --from=build /lib64/ld-linux-x86-64.so.2 .
WORKDIR /lib/x86_64-linux-gnu
COPY --from=build /lib/x86_64-linux-gnu/libmbedtls.so.14 .
COPY --from=build /lib/x86_64-linux-gnu/libmbedcrypto.so.7 .
COPY --from=build /lib/x86_64-linux-gnu/libmbedx509.so.1 .
COPY --from=build /lib/x86_64-linux-gnu/libhttp_parser.so.2.9 .
COPY --from=build /lib/x86_64-linux-gnu/libcmocka.so.0 .
COPY --from=build /lib/x86_64-linux-gnu/libc.so.6 .
COPY --from=build /lib/x86_64-linux-gnu/librt.so.1 .
WORKDIR /
COPY --from=build /cmender/build/platform/linux/test_tool/test_tool .
ENTRYPOINT ["/test_tool"]
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ make

### One-time setup

* Build the client
* Build the client, or build container image when running macOS (container image only tested on intel macs):

```bash
docker build -t cmender-test-tool .
```

* Create menderstore directory:

```bash
Expand Down Expand Up @@ -106,6 +111,12 @@ start the test client with the following command and display the help:
./platform/linux/test_tool/test_tool -h
```

Or via docker:

```bash
docker run -v ./data:/data cmender-test-tool -h
```

After a deployment the test tool exits instead of a reboot a real device
would do. Start the test tool again but set the artifact name to the deployed
version. After that the server should indicate a successful deployment.
Expand Down