* [LTP] [PATCH v2 1/2] Add simple Containerfile
@ 2023-10-09 10:24 Richard Palethorpe via ltp
2023-10-09 10:24 ` [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts Richard Palethorpe via ltp
2023-10-09 12:00 ` [LTP] [PATCH v2 1/2] Add simple Containerfile Petr Vorel
0 siblings, 2 replies; 5+ messages in thread
From: Richard Palethorpe via ltp @ 2023-10-09 10:24 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
This adds a regular container (or Docker) file which builds LTP from
source. This is initially intended for testing the LTP itself.
The resulting container has just the LTP installation and runtime
dependencies. However it is still quite large, probably due to debug
symbols.
The container can be built with a command like:
podman build -t tumbleweed/ltp \
--build-arg PREFIX=registry.opensuse.org/opensuse/ \
--build-arg DISTRO_NAME=tumbleweed \
--build-arg DISTRO_RELEASE=20230925 .
Or just
podman build .
which will create an Alpine container.
It contains Kirk in /opt/kirk. So
cd /opt/kirk && ./kirk -f ltp -r syscalls
will run some tests.
Note a much smaller container can be found at:
https://registry.opensuse.org/cgi-bin/cooverview?srch_term=project%3D%5Ebenchmark+container%3D.*
This is created with SUSE's build system which does not use container files
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Cc: Petr Vorel <pvorel@suse.cz>
Cc: Marius Kittler <mkittler@suse.de>
---
V2:
* Added some docs. I didn't say too much because I think we are likely
to invalidate all of this info as we start testing in containers.
.dockerignore | 1 +
Containerfile | 32 ++++++++++++++++++++++++++++++++
README.md | 31 +++++++++++++++++++++++++++++++
ci/alpine-runtime.sh | 16 ++++++++++++++++
ci/tumbleweed-runtime.sh | 13 +++++++++++++
5 files changed, 93 insertions(+)
create mode 100644 .dockerignore
create mode 100644 Containerfile
create mode 100755 ci/alpine-runtime.sh
create mode 100755 ci/tumbleweed-runtime.sh
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..bbcd7072f
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+Containerfile
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 000000000..2f8192c3b
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,32 @@
+ARG PREFIX=docker.io/
+ARG DISTRO_NAME=alpine
+ARG DISTRO_RELEASE=3.18
+
+FROM $PREFIX$DISTRO_NAME:$DISTRO_RELEASE AS build
+ARG LTPROOT=/opt/ltp
+ARG DISTRO_NAME=alpine
+ARG DISTRO_RELEASE=3.18
+
+RUN mkdir /build
+WORKDIR /build
+COPY . /build
+RUN ./ci/${DISTRO_NAME}.sh
+RUN git clean -fdX
+RUN ./build.sh -p $LTPROOT -i
+
+FROM $PREFIX$DISTRO_NAME:$DISTRO_RELEASE
+ARG LTPROOT=/opt/ltp
+ARG KIRKROOT=/opt/kirk
+ARG DISTRO_NAME=alpine
+
+COPY --from=build /build/ci/${DISTRO_NAME}-runtime.sh $LTPROOT/runtime-deps.sh
+RUN $LTPROOT/runtime-deps.sh
+
+COPY --from=build $LTPROOT $LTPROOT
+ENV LTPROOT=$LTPROOT
+ENV PATH=$LTPROOT/testcases/bin:$LTPROOT/bin:$PATH
+
+RUN mkdir -p $KIRKROOT
+COPY --from=build /build/tools/kirk $KIRKROOT
+
+USER ltp
diff --git a/README.md b/README.md
index a0813b0a1..fa9559398 100644
--- a/README.md
+++ b/README.md
@@ -184,6 +184,37 @@ Network tests
Network tests require certain setup, described in `testcases/network/README.md`
(online at https://github.com/linux-test-project/ltp/tree/master/testcases/network).
+Containers
+----------
+
+*Presently running the LTP inside a container is not a shortcut. It
+will make things much harder for you.*
+
+There is a Containerfile which can be used with Docker or
+Podman. Currently it can build Alpine and OpenSUSE images.
+
+The container can be built with a command like:
+
+```
+$ podman build -t tumbleweed/ltp \
+ --build-arg PREFIX=registry.opensuse.org/opensuse/ \
+ --build-arg DISTRO_NAME=tumbleweed \
+ --build-arg DISTRO_RELEASE=20230925 .
+```
+
+Or just `podman build .` which will create an Alpine container.
+
+It contains Kirk in /opt/kirk. So the following will run some tests.
+
+```
+$ podman run -it --rm tumbleweed/ltp:latest
+$ cd /opt/kirk && ./kirk -f ltp -r syscalls
+```
+
+SUSE also publishes a
+[smaller LTP container](https://registry.opensuse.org/cgi-bin/cooverview?srch_term=project%3D%5Ebenchmark+container%3D.*)
+that is not based on the Containerfile.
+
Developers corner
=================
diff --git a/ci/alpine-runtime.sh b/ci/alpine-runtime.sh
new file mode 100755
index 000000000..e4941f329
--- /dev/null
+++ b/ci/alpine-runtime.sh
@@ -0,0 +1,16 @@
+#!/bin/sh -eux
+
+apk add \
+ acl \
+ keyutils \
+ libaio \
+ libacl \
+ libcap \
+ libselinux \
+ libsepol \
+ libtirpc \
+ numactl \
+ openssl \
+ py3-msgpack
+
+adduser -D -g "Unprivileged LTP user" ltp
diff --git a/ci/tumbleweed-runtime.sh b/ci/tumbleweed-runtime.sh
new file mode 100755
index 000000000..5207988e7
--- /dev/null
+++ b/ci/tumbleweed-runtime.sh
@@ -0,0 +1,13 @@
+#!/bin/sh -eux
+
+zyp="zypper --non-interactive install --force-resolution --no-recommends"
+
+$zyp \
+ iproute2 \
+ keyutils \
+ libaio1 \
+ libmnl0 \
+ libnuma1 \
+ libtirpc3
+
+useradd ltp
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts
2023-10-09 10:24 [LTP] [PATCH v2 1/2] Add simple Containerfile Richard Palethorpe via ltp
@ 2023-10-09 10:24 ` Richard Palethorpe via ltp
2023-10-09 11:58 ` Petr Vorel
2023-10-09 12:00 ` [LTP] [PATCH v2 1/2] Add simple Containerfile Petr Vorel
1 sibling, 1 reply; 5+ messages in thread
From: Richard Palethorpe via ltp @ 2023-10-09 10:24 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Suggested-by: Petr Vorel <pvorel@suse.cz>
---
ci/alpine.sh | 3 +--
ci/debian.cross-compile.sh | 3 +--
ci/debian.i386.sh | 3 +--
ci/debian.minimal.sh | 3 +--
ci/debian.sh | 3 +--
ci/fedora.sh | 3 +--
ci/tumbleweed.sh | 3 +--
7 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/ci/alpine.sh b/ci/alpine.sh
index 9ae5a8d07..efd1f6de4 100755
--- a/ci/alpine.sh
+++ b/ci/alpine.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2019-2022 Petr Vorel <petr.vorel@gmail.com>
-set -ex
apk update
diff --git a/ci/debian.cross-compile.sh b/ci/debian.cross-compile.sh
index 0a7ef7710..e2dea2ee0 100755
--- a/ci/debian.cross-compile.sh
+++ b/ci/debian.cross-compile.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
if [ -z "$ARCH" ]; then
echo "missing \$ARCH!" >&2
diff --git a/ci/debian.i386.sh b/ci/debian.i386.sh
index 707a23ca6..e6017de65 100755
--- a/ci/debian.i386.sh
+++ b/ci/debian.i386.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2018-2020 Petr Vorel <pvorel@suse.cz>
-set -ex
dpkg --add-architecture i386
apt update
diff --git a/ci/debian.minimal.sh b/ci/debian.minimal.sh
index b51154b05..780258676 100755
--- a/ci/debian.minimal.sh
+++ b/ci/debian.minimal.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2018-2023 Petr Vorel <pvorel@suse.cz>
-set -ex
apt="apt remove -y"
diff --git a/ci/debian.sh b/ci/debian.sh
index da92337fb..6d0c9eb13 100755
--- a/ci/debian.sh
+++ b/ci/debian.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2018-2021 Petr Vorel <pvorel@suse.cz>
-set -ex
# workaround for missing oldstable-updates repository
# W: Failed to fetch http://deb.debian.org/debian/dists/oldstable-updates/main/binary-amd64/Packages
diff --git a/ci/fedora.sh b/ci/fedora.sh
index a603bcbe3..2e4e87bca 100755
--- a/ci/fedora.sh
+++ b/ci/fedora.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2018-2021 Petr Vorel <pvorel@suse.cz>
-set -ex
yum="yum -y install --skip-broken"
diff --git a/ci/tumbleweed.sh b/ci/tumbleweed.sh
index f1e7252f2..2e2b05aa5 100755
--- a/ci/tumbleweed.sh
+++ b/ci/tumbleweed.sh
@@ -1,6 +1,5 @@
-#!/bin/sh
+#!/bin/sh -eux
# Copyright (c) 2018-2021 Petr Vorel <pvorel@suse.cz>
-set -ex
zyp="zypper --non-interactive install --force-resolution --no-recommends"
--
2.40.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts
2023-10-09 10:24 ` [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts Richard Palethorpe via ltp
@ 2023-10-09 11:58 ` Petr Vorel
2023-10-10 8:59 ` Richard Palethorpe
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-10-09 11:58 UTC (permalink / raw)
To: Richard Palethorpe; +Cc: ltp
Hi Richie,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Thank you!
Could you please before you commit also add license to the files:
# SPDX-License-Identifier: GPL-2.0-or-later
And maybe your/LTP copyright (whatever you prefer) into files you added?
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 1/2] Add simple Containerfile
2023-10-09 10:24 [LTP] [PATCH v2 1/2] Add simple Containerfile Richard Palethorpe via ltp
2023-10-09 10:24 ` [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts Richard Palethorpe via ltp
@ 2023-10-09 12:00 ` Petr Vorel
1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-10-09 12:00 UTC (permalink / raw)
To: Richard Palethorpe; +Cc: ltp
Hi Richie,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Thanks for adding readme!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts
2023-10-09 11:58 ` Petr Vorel
@ 2023-10-10 8:59 ` Richard Palethorpe
0 siblings, 0 replies; 5+ messages in thread
From: Richard Palethorpe @ 2023-10-10 8:59 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hello,
Updated with suggested changes and pushed, thanks!
Petr Vorel <pvorel@suse.cz> writes:
> Hi Richie,
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Thank you!
>
> Could you please before you commit also add license to the files:
> # SPDX-License-Identifier: GPL-2.0-or-later
>
> And maybe your/LTP copyright (whatever you prefer) into files you
> added?
>
> Kind regards,
> Petr
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-10 9:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09 10:24 [LTP] [PATCH v2 1/2] Add simple Containerfile Richard Palethorpe via ltp
2023-10-09 10:24 ` [LTP] [PATCH v2 2/2] ci: Check for undefined variables in all scripts Richard Palethorpe via ltp
2023-10-09 11:58 ` Petr Vorel
2023-10-10 8:59 ` Richard Palethorpe
2023-10-09 12:00 ` [LTP] [PATCH v2 1/2] Add simple Containerfile Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox