Skip to content
Merged
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
10 changes: 10 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ else
noinst_LTLIBRARIES = libcrun.la
endif

if BUILD_TESTS
check_LTLIBRARIES = libcrun_testing.la
endif

libcrun_SOURCES = src/libcrun/utils.c \
src/libcrun/string_map.c \
Expand Down Expand Up @@ -87,9 +89,11 @@ libcrun_la_LIBADD = libocispec/libocispec.la $(FOUND_LIBS) $(maybe_libyajl.la)
libcrun_la_LDFLAGS = -Wl,--version-script=$(abs_top_srcdir)/libcrun.lds

# build a version with all the symbols visible for testing
if BUILD_TESTS
libcrun_testing_la_SOURCES = $(libcrun_SOURCES)
libcrun_testing_la_CFLAGS = -I $(abs_top_builddir)/libocispec/src -I $(abs_top_srcdir)/libocispec/src -fvisibility=default
libcrun_testing_la_LIBADD = libocispec/libocispec.la $(maybe_libyajl.la)
endif

if PYTHON_BINDINGS
pyexec_LTLIBRARIES = python_crun.la
Expand Down Expand Up @@ -163,7 +167,9 @@ EXTRA_DIST = COPYING COPYING.libcrun README.md NEWS SECURITY.md rpm/crun.spec au
krun.1.md krun.1 \
lua/luacrun.rockspec

if BUILD_TESTS
UNIT_TESTS = tests/tests_libcrun_utils tests/tests_libcrun_ring_buffer tests/tests_libcrun_errors tests/tests_libcrun_intelrdt
endif
Comment on lines +170 to +172
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it affect make dist and what files are included in the tarball if we build without glibc-static?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn´t affect make dist (tested on fedora42). autotools is smart enough to comment out only the build section for the tools and keep the _SOURCE bits for *_DIST sections.

Just one example:

$ grep tests_libcrun_utils Makefile
am__tests_tests_libcrun_utils_SOURCES_DIST =  \
        tests/tests_libcrun_utils.c

and just to be 100% safe. Done 2 make dist, one with glib-static and one without:

crun-without/tests$ ls -1 | wc -l
34

crun-with/tests$ ls -1 | wc -l
34

fabbione@mazikeen:~/work/containers$ diff -Naurd crun-without/ crun-with
fabbione@mazikeen:~/work/containers$


if ENABLE_CRUN
bin_PROGRAMS = crun
Expand All @@ -172,6 +178,7 @@ else
noinst_PROGRAMS = crun
endif

if BUILD_TESTS
check_PROGRAMS = tests/init $(UNIT_TESTS) tests/tests_libcrun_fuzzer

TESTS_LDADD = libcrun_testing.la $(FOUND_LIBS) $(maybe_libyajl.la)
Expand Down Expand Up @@ -205,6 +212,7 @@ tests_tests_libcrun_errors_SOURCES = tests/tests_libcrun_errors.c
tests_tests_libcrun_errors_LDADD = $(TESTS_LDADD)
tests_tests_libcrun_errors_LDFLAGS = $(crun_LDFLAGS)

endif
TEST_EXTENSIONS = .py
PY_LOG_COMPILER = $(PYTHON)
PY_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh
Expand Down Expand Up @@ -236,7 +244,9 @@ PYTHON_TESTS = tests/test_capabilities.py \
tests/test_time.py \
tests/test_bpf_devices.py

if BUILD_TESTS
TESTS = $(PYTHON_TESTS) $(UNIT_TESTS)
endif

.version:
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
Expand Down
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ AC_CHECK_TYPES([atomic_int], [], [], [[#include <stdatomic.h>]])

AC_CHECK_FUNCS(eaccess hsearch_r copy_file_range fgetxattr statx fgetpwent_r issetugid memfd_create)

case "${lt_cv_prog_compiler_static_works}" in
yes) build_tests=true ;;
no)
AC_MSG_WARN([Static compilation not working. Test suite cannot be built / executed. Make sure to install glibc-static or equivalent.])
build_tests=false
;;
*) ;;
esac
AM_CONDITIONAL([BUILD_TESTS], [test "x${build_tests}" = xtrue])

AC_ARG_ENABLE(crun,
AS_HELP_STRING([--enable-crun], [Include crun executable in installation (default: yes)]),
[
Expand Down
1 change: 1 addition & 0 deletions rpm/crun.spec
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Recommends: criu-libs
BuildRequires: wasmedge-devel
%endif
BuildRequires: python
BuildRequires: glibc-static
Provides: oci-runtime

%description
Expand Down
2 changes: 1 addition & 1 deletion tests/centos10-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM quay.io/centos/centos:stream10-development

RUN yum --enablerepo='appstream' --enablerepo='baseos' --enablerepo='crb' install -y make \
automake autoconf gettext criu-devel libtool gcc libcap-devel systemd-devel \
libseccomp-devel python3 libtool git protobuf-c protobuf-c-devel xz
libseccomp-devel python3 libtool git protobuf-c protobuf-c-devel xz glibc-static

COPY run-tests.sh /usr/local/bin

Expand Down
2 changes: 1 addition & 1 deletion tests/centos8-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM quay.io/centos/centos:stream8
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
yum --enablerepo='powertools' install -y make automake autoconf gettext \
criu-devel libtool gcc libcap-devel systemd-devel yajl-devel \
libseccomp-devel python36 libtool git
libseccomp-devel python36 libtool git glibc-static

COPY run-tests.sh /usr/local/bin

Expand Down
2 changes: 1 addition & 1 deletion tests/centos9-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM quay.io/centos/centos:stream9

RUN yum --enablerepo='appstream' --enablerepo='baseos' --enablerepo='crb' install -y make \
automake autoconf gettext criu-devel libtool gcc libcap-devel systemd-devel yajl-devel \
libseccomp-devel python3 libtool git protobuf-c protobuf-c-devel
libseccomp-devel python3 libtool git protobuf-c protobuf-c-devel glibc-static

COPY run-tests.sh /usr/local/bin

Expand Down
2 changes: 1 addition & 1 deletion tests/clang-check/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM fedora:latest

RUN dnf install -y awk git protobuf-c protobuf-c-devel make clang-tools-extra clang python3-pip 'dnf-command(builddep)' && \
RUN dnf install -y awk git protobuf-c protobuf-c-devel make clang-tools-extra clang python3-pip glibc-static 'dnf-command(builddep)' && \
dnf builddep -y crun && pip install scan-build

COPY run-tests.sh /usr/local/bin
Expand Down
2 changes: 1 addition & 1 deletion tests/clang-format/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM fedora:latest

RUN dnf install -y awk git make clang-tools-extra 'dnf-command(builddep)' && dnf builddep -y crun
RUN dnf install -y awk git make clang-tools-extra glibc-static 'dnf-command(builddep)' && dnf builddep -y crun

COPY run-tests.sh /usr/local/bin
ENTRYPOINT /usr/local/bin/run-tests.sh