]> git.ipfire.org Git - thirdparty/kmod.git/blobdiff - Makefile.am
test-modprobe: share single function for kcmdline tests
[thirdparty/kmod.git] / Makefile.am
index 97a963104ae3381b42e307e5febe12e940e311f5..24a586e795ce2f2e489f06dcc948a1241ec4b23a 100644 (file)
@@ -7,6 +7,7 @@ endif
 DISTCLEAN_LOCAL_HOOKS =
 EXTRA_DIST =
 CLEANFILES = $(BUILT_FILES)
+DISTCLEANFILES =
 BUILT_FILES =
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 AM_MAKEFLAGS = --no-print-directory
@@ -30,18 +31,35 @@ SED_PROCESS = \
        -e 's,@exec_prefix\@,$(exec_prefix),g' \
        -e 's,@libdir\@,$(libdir),g' \
        -e 's,@includedir\@,$(includedir),g' \
+       -e 's,@libzstd_CFLAGS\@,${libzstd_CFLAGS},g' \
+       -e 's,@libzstd_LIBS\@,${libzstd_LIBS},g' \
        -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
        -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
        -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
        -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
+       -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
+       -e 's,@libcrypto_LIBS\@,${libcrypto_LIBS},g' \
        < $< > $@ || rm $@
 
 %.pc: %.pc.in Makefile
        $(SED_PROCESS)
 
-LIBKMOD_CURRENT=4
-LIBKMOD_REVISION=9
-LIBKMOD_AGE=2
+# Rules for libtool versioning (from https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html)
+# 1. Start with version information of ‘0:0:0’ for each libtool library.
+# 2. Update the version information only immediately before a public release of
+#    your software. More frequent updates are unnecessary, and only guarantee that
+#    the current interface number gets larger faster.
+# 3. If the library source code has changed at all since the last update, then
+#    increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
+# 4. If any interfaces have been added, removed, or changed since the last
+#    update, increment current, and set revision to 0.
+# 5. If any interfaces have been added since the last public release, then
+#    increment age.
+# 6. If any interfaces have been removed or changed since the last public
+#    release, then set age to 0.
+LIBKMOD_CURRENT=5
+LIBKMOD_REVISION=6
+LIBKMOD_AGE=3
 
 noinst_LTLIBRARIES = shared/libshared.la
 shared_libshared_la_SOURCES = \
@@ -51,6 +69,8 @@ shared_libshared_la_SOURCES = \
        shared/array.h \
        shared/hash.c \
        shared/hash.h \
+       shared/scratchbuf.c \
+       shared/scratchbuf.h \
        shared/strbuf.c \
        shared/strbuf.h \
        shared/util.c \
@@ -63,6 +83,7 @@ libkmod_libkmod_la_SOURCES = \
        libkmod/libkmod.h \
        libkmod/libkmod-internal.h \
        libkmod/libkmod.c \
+       libkmod/libkmod-builtin.c \
        libkmod/libkmod-list.c \
        libkmod/libkmod-config.c \
        libkmod/libkmod-index.c \
@@ -84,7 +105,7 @@ libkmod_libkmod_la_DEPENDENCIES = \
        ${top_srcdir}/libkmod/libkmod.sym
 libkmod_libkmod_la_LIBADD = \
        shared/libshared.la \
-       ${liblzma_LIBS} ${zlib_LIBS}
+       ${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
 
 noinst_LTLIBRARIES += libkmod/libkmod-internal.la
 libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
@@ -127,6 +148,13 @@ tools_kmod_SOURCES = \
        tools/modinfo.c tools/modprobe.c \
        tools/depmod.c tools/log.h tools/log.c \
        tools/static-nodes.c
+
+if BUILD_EXPERIMENTAL
+tools_kmod_SOURCES += \
+       tools/insert.c \
+       tools/remove.c
+endif
+
 tools_kmod_LDADD = \
        shared/libshared.la \
        libkmod/libkmod-internal.la
@@ -161,7 +189,10 @@ CPYTHON_MODULE_CFLAGS = \
        $(AM_CFLAGS) -DCPYTHON_COMPILING_IN_PYPY=0 \
        $(PYTHON_NOWARN) $(PYTHON_CFLAGS) \
        -fvisibility=default
-CPYTHON_MODULE_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared
+# Filter -Wl,--no-undefined to fix build with python 3.8
+comma = ,
+CPYTHON_MODULE_LDFLAGS = $(subst -Wl$(comma)--no-undefined,,$(AM_LDFLAGS))
+CPYTHON_MODULE_LDFLAGS += -module -avoid-version -shared
 
 if BUILD_PYTHON
 pkgpyexec_LTLIBRARIES = \
@@ -215,10 +246,11 @@ ROOTFS = testsuite/rootfs
 ROOTFS_PRISTINE = $(top_srcdir)/testsuite/rootfs-pristine
 CREATE_ROOTFS = $(AM_V_GEN) ( $(RM) -rf $(ROOTFS) && mkdir -p $(dir $(ROOTFS)) && \
                                cp -r $(ROOTFS_PRISTINE) $(ROOTFS) && \
-                               touch testsuite/stamp-rootfs && \
                                find $(ROOTFS) -type d -exec chmod +w {} \; && \
+                               find $(ROOTFS) -type f -name .gitignore -exec rm -f {} \; && \
                                $(top_srcdir)/testsuite/populate-modules.sh \
-                                       $(MODULE_PLAYGROUND) $(ROOTFS) )
+                                       $(MODULE_PLAYGROUND) $(ROOTFS) $(top_builddir)/config.h ) && \
+                               touch testsuite/stamp-rootfs
 
 build-module-playground:
        $(AM_V_GEN)if test "$(top_srcdir)" != "$(top_builddir)"; then \
@@ -226,7 +258,12 @@ build-module-playground:
                cp -r $(top_srcdir)/$(MODULE_PLAYGROUND) $(top_builddir)/$(MODULE_PLAYGROUND) && \
                find $(top_builddir)/$(MODULE_PLAYGROUND) -type d -exec chmod +w {} \; ; \
                fi
+if BUILD_MODULES
        $(MAKE) -C $(MODULE_PLAYGROUND)
+else
+       $(MAKE) -C $(MODULE_PLAYGROUND) FAKE_BUILD=1
+endif
+
 
 rootfs: build-module-playground
        $(CREATE_ROOTFS)
@@ -243,18 +280,40 @@ TESTSUITE_OVERRIDE_LIBS = \
 TESTSUITE_OVERRIDE_LIBS_LDFLAGS = \
        avoid-version -module -shared -export-dynamic -rpath /nowhere -ldl
 
-check-sysconfdir:
-       $(AM_V_at)if test "$(sysconfdir)" != "/etc" -a "$(sysconfdir)" != "/etc/"; then \
-               echo "warning: Some tests will fail without --sysconfdir=/etc" >&2; \
-       fi
-.PHONY: check-sysconfdir
-
-check-am: rootfs check-sysconfdir
-
-
-EXTRA_DIST += testsuite/module-playground/Makefile \
-             testsuite/module-playground/mod-simple.c
-
+check-am: rootfs
+
+
+EXTRA_DIST += \
+       testsuite/module-playground/cache \
+       testsuite/module-playground/dummy.pkcs7 \
+       testsuite/module-playground/dummy.sha1 \
+       testsuite/module-playground/dummy.sha256 \
+       testsuite/module-playground/Makefile \
+       testsuite/module-playground/Makefile.arch \
+       testsuite/module-playground/mod-fake-cciss.c \
+       testsuite/module-playground/mod-fake-hpsa.c \
+       testsuite/module-playground/mod-fake-scsi-mod.c \
+       testsuite/module-playground/mod-foo-a.c \
+       testsuite/module-playground/mod-foo-b.c \
+       testsuite/module-playground/mod-foo.c \
+       testsuite/module-playground/mod-foo-c.c \
+       testsuite/module-playground/mod-loop-a.c \
+       testsuite/module-playground/mod-loop-b.c \
+       testsuite/module-playground/mod-loop-c.c \
+       testsuite/module-playground/mod-loop-d.c \
+       testsuite/module-playground/mod-loop-e.c \
+       testsuite/module-playground/mod-loop-f.c \
+       testsuite/module-playground/mod-loop-g.c \
+       testsuite/module-playground/mod-loop-h.c \
+       testsuite/module-playground/mod-loop-i.c \
+       testsuite/module-playground/mod-loop-j.c \
+       testsuite/module-playground/mod-loop-k.c \
+       testsuite/module-playground/mod-loop.h \
+       testsuite/module-playground/mod-simple.c \
+       testsuite/module-playground/mod-simple-i386.ko \
+       testsuite/module-playground/mod-simple-sparc64.ko \
+       testsuite/module-playground/mod-simple-x86_64.ko \
+       testsuite/module-playground/README
 
 check_LTLIBRARIES = $(TESTSUITE_OVERRIDE_LIBS)
 
@@ -276,6 +335,10 @@ TESTSUITE_LDADD = \
        testsuite/libtestsuite.la libkmod/libkmod-internal.la \
        shared/libshared.la
 
+if KMOD_SYSCONFDIR_NOT_ETC
+TESTSUITE_CPPFLAGS += -DKMOD_SYSCONFDIR_NOT_ETC
+endif
+
 check_LTLIBRARIES += testsuite/libtestsuite.la
 testsuite_libtestsuite_la_SOURCES = \
        testsuite/testsuite.c testsuite/testsuite.h
@@ -287,13 +350,21 @@ testsuite_libtestsuite_la_LIBADD = -lrt
 TESTSUITE = \
        testsuite/test-hash \
        testsuite/test-array \
+       testsuite/test-scratchbuf \
        testsuite/test-strbuf \
-       testsuite/test-init testsuite/test-testsuite testsuite/test-loaded \
+       testsuite/test-init \
+       testsuite/test-initstate \
+       testsuite/test-testsuite testsuite/test-loaded \
        testsuite/test-modinfo testsuite/test-util testsuite/test-new-module \
        testsuite/test-modprobe testsuite/test-blacklist \
        testsuite/test-dependencies testsuite/test-depmod \
        testsuite/test-list
 
+if BUILD_EXPERIMENTAL
+TESTSUITE += \
+       testsuite/test-tools
+endif
+
 check_PROGRAMS = $(TESTSUITE)
 TESTS = $(TESTSUITE)
 
@@ -307,11 +378,16 @@ testsuite_test_hash_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 testsuite_test_array_LDADD = $(TESTSUITE_LDADD)
 testsuite_test_array_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 
+testsuite_test_scratchbuf_LDADD = $(TESTSUITE_LDADD)
+testsuite_test_scratchbuf_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
+
 testsuite_test_strbuf_LDADD = $(TESTSUITE_LDADD)
 testsuite_test_strbuf_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 
 testsuite_test_init_LDADD = $(TESTSUITE_LDADD)
 testsuite_test_init_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
+testsuite_test_initstate_LDADD = $(TESTSUITE_LDADD)
+testsuite_test_initstate_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 testsuite_test_loaded_LDADD = $(TESTSUITE_LDADD)
 testsuite_test_loaded_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 testsuite_test_modinfo_LDADD = $(TESTSUITE_LDADD)
@@ -331,6 +407,11 @@ testsuite_test_depmod_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 testsuite_test_list_LDADD = $(TESTSUITE_LDADD)
 testsuite_test_list_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
 
+if BUILD_EXPERIMENTAL
+testsuite_test_tools_LDADD = $(TESTSUITE_LDADD)
+testsuite_test_tools_CPPFLAGS = $(TESTSUITE_CPPFLAGS)
+endif
+
 testsuite-distclean:
        $(RM) -r $(ROOTFS)
        $(RM) testsuite/stamp-rootfs
@@ -343,7 +424,7 @@ DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
 EXTRA_DIST += testsuite/rootfs-pristine
 
 DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-python --sysconfdir=/etc \
-       --with-zlib \
+       --with-zlib --with-zstd --with-openssl \
        --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir)
 
 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
@@ -390,6 +471,31 @@ lcov-run lcov-report:
 
 endif
 
+# ------------------------------------------------------------------------------
+# coverity
+# ------------------------------------------------------------------------------
+
+kmod-coverity-%.tar.xz:
+       rm -rf $< cov-int
+       ./autogen.sh c --disable-python --disable-manpages
+       make clean
+       cov-build --dir cov-int make -j 4
+       tar caf $@ cov-int
+
+coverity-tar: kmod-coverity-$(shell git describe  2>/dev/null).tar.xz
+
+coverity-sync: kmod-coverity-$(shell git describe 2>/dev/null).tar.xz
+       @echo "uploading coverity tarball"
+       @curl --form token=$(COVERITY_KMOD_TOKEN) \
+               --form email=lucas.de.marchi@gmail.com \
+               --form file=@$< \
+               --form version="$(shell git describe)" \
+               --form description="" \
+               https://scan.coverity.com/builds?project=kmod
+
+coverity-clean:
+       rm -rf kmod-coverity-*.tar.xz cov-int
+
 # ------------------------------------------------------------------------------
 # custom release helpers
 # ------------------------------------------------------------------------------
@@ -410,3 +516,13 @@ tar: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
 
 tar-sync: kmod-$(VERSION).tar.xz kmod-$(VERSION).tar.sign
        kup put kmod-$(VERSION).tar.xz  kmod-$(VERSION).tar.sign /pub/linux/utils/kernel/kmod/
+
+# ------------------------------------------------------------------------------
+# mkosi
+# ------------------------------------------------------------------------------
+
+DISTRO ?= "arch"
+
+mkosi:
+       -$(MKDIR_P) $(top_srcdir)/testsuite/mkosi/mkosi.cache
+       $(MKOSI) -C $(top_srcdir)/testsuite/mkosi --build-sources ../../ --default mkosi.${DISTRO} -fi