25 Commits

Author SHA1 Message Date
Gongjun Song
b73b52004e Added the test case of using multiple softdep for a module
We defined two modules mod-softdep-a and mod-softdep-b. The softdep
statements are split into two separate modprobe configure files.

The unit test case is supposed to fail, since the libkmod will take
only the first softdep statement based on the current implementation.

Co-developed-by: Dan He <dan.h.he@intel.com>
Signed-off-by: Dan He <dan.h.he@intel.com>
Co-developed-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Yuchi Chen <yuchi.chen@intel.com>
Signed-off-by: Wenjie Wang <wenjie2.wang@intel.com>
Signed-off-by: Qingqing Li <qingqing.li@intel.com>
Link: https://github.com/kmod-project/kmod/pull/311
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-03-28 10:59:48 -05:00
Lucas De Marchi
ec3baed9f9 testsuite: Test depmod with relative -m
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/243
2024-11-20 22:25:30 -06:00
Lucas De Marchi
d8b2455f40 testsuite: Simplify defines for depmod -m test
Simplify the defines so it's easier to extend the test for another
directory.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/243
2024-11-20 22:25:30 -06:00
Emil Velikov
c7686797fc scripts/sanitizer-env.sh: support new clang 19 DSO
Seemingly with version 19, the CPU arch was dropped from the DSO name.
Try that and fallback to the old one, as applicable.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/219
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-11-07 11:07:41 -06:00
Emil Velikov
870aa6fe99 scripts/sanitizer-env.sh: check and warn if OUR_PRELOAD is not a file
As seen with the upcoming clang 19 change, the library name has changed.
Enhance the current test to check if the compiler provided string is a
file and produce a warning with some handy tips when that's not the
case.

v2:
 - convert to heredoc
 - output to stderr

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/219
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-11-07 11:07:41 -06:00
Emil Velikov
613a21d662 scripts/sanitizer-env.sh: promote unknown compiler to warning/stderr
Should make it more distinguishable, depending on shell and/or CI setup,
from the informational message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/219
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-11-07 11:07:41 -06:00
Emil Velikov
34a066b6e3 scripts/sanitizer-env.sh: convert to heredoc
Convert to heredoc and add leading/trailing blank lines so it stands out
from the rest. It makes for cleaner reading experience both of the
script itself and its output.

As suggested by Lucas.

v2:
 - don't escape ", drop spurious instance

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/219
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-11-07 11:07:41 -06:00
Emil Velikov
f35ef15374 meson: bump to 0.61, use install_symlink()
Bump the meson requirement to 0.61 which allows us to remove our clunky
shell script in favour of the native install_symlink().

In terms of OS support - according to repology, all distributions which
have 0.60 (Fedora 36 + winget) also have 0.61 in their repositories.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/209
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-24 18:10:12 -05:00
Lucas De Marchi
e3c326a909 meson: Fix installing without DESTDIR
Script fails because of `set -u`. Make sure DESTDIR is set to something

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # meson v1.6.0
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/206
2024-10-23 23:17:02 -05:00
Emil Velikov
844835cd9a meson: always pass complete path to kmod-symlink.sh
The end-user can provide either relative (to prefix) or an absolute
directory for bindir. Just fold the prefix and bindir with join_path()
which handles this correctly and pass that to kmod-symlink.sh instead of
relying on the MESON_INSTALL_DESTDIR_PREFIX environment variable.

This was previously failing due to trying to create the symlink in the
wrong location:

	$ meson setup --prefix /usr --bindir /bin build-gentoo
	$ DESTDIR=/tmp/install-gentoo meson install -C build-gentoo/
	...
	ln: failed to create symbolic link '/tmp/install-gentoo/usr//bin/depmod': No such file or directory
	FAILED: install script '/home/ldmartin/p/kmod/scripts/kmod-symlink.sh /bin/depmod' failed with exit code 1.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/205
[ fix typo, add repro ]
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-23 10:54:41 -05:00
Emil Velikov
f5b4ff82f4 Add support for clang sanitizers
By default clang uses static sanitizer libraries, which causes build and
test-time failures. Swap for the shared libasan which resolves both.

Note: meson tries to be helpful here, throwing a warning that we should
use -D b_lundef=false which is incorrect in our case.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/172
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-18 13:22:12 -05:00
Emil Velikov
0b3c45e5c9 scripts/test-wrapper.sh: convert to sanitizer-env.sh
Convert the existing wrapper script, into one that we source to set the
environment aka LD_PRELOAD.

Thus a developer can, use/test/debug the tests without using meson.
Namely:
 - source scripts/sanitizer-env.sh
 - build/testsuite/test-depmod

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/172
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-18 13:22:11 -05:00
Emil Velikov
e16d92b429 Swap rsync for cp --archive for module sources copying
As Tobias reported, rsync is a bit of heavyweight dependency. We
introduced it, as a replacement for the rm/cp -r previously used.

The rsync was inspired since, unlike make, meson will build all the test
binaries/artefacts even without calling "meson test".

We can go back to cp with --archive (--preserve=timestamps at least),
which will ensure we don't get stale files. To ensure the second run
doesn't copy the source folder as _subfolder_ of the dest we need to
wildcard the copy... Plus we need a proper destination folder in the
first place.

With this, we get a no-op second+ builds - be that with meson or make.
Since the explicit always-dirty state is by design, drop the meson TODO
and document the output variable.

Confirmed by comparing both the `make --debug` output and the execution
times.

Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/192
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-17 16:57:43 -05:00
Emil Velikov
b81b4d62d5 testsuite: fix gcc/libasan.so load order
Currently we silence the ordering warning from libasan, via the
environment: ASAN_OPTIONS=verify_asan_link_order=0...

Instead we should be LD_PRELOAD-ing the library, since otherwise we
might end with miss-matched symbols - one coming from libasan, with the
counter part from the system library.

Plus LD_PRELOAD is the only way to make the clang sanitizers work...
That I have found. Although that's coming with a later patch.

v2:
 - handle when the file is a script

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/179
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-17 08:35:10 -05:00
Emil Velikov
5798e18844 Move sanitizer details into a test wrapper
We want the meson test target to be self contained and having an
essential variables defined in the GitHub CI is heading the opposite
direction.

Create a wrapper that does this for us.

v2:
 - add the script to the autotools tarball/EXTRA_DIST

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/179
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-10-17 08:35:10 -05:00
Lucas De Marchi
aa9f6d89e7 build: Fix KDIR again
KDIR is not related to the what we configure in kmod's build. It's only
used in kmod to locate where the distro's kernel source/headers is,
which may be different from what we are configuring the (under
development) kmod with.

Remove the setting from meson/autotools and figure it out inside the
module-playground Makefile what should be used. For advanced use cases,
KDIR= can be passed to override the location.

For our own tests, which includes testing with a different module_directory,
scripts/setup-rootfs.sh will copy the module to the desired location
according to the map defined in the script.

Fixes: 27ff72732666 ("testsuite: correct the default KDIR")
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/125
2024-09-11 14:39:10 -05:00
Lucas De Marchi
aa7130edaf testsuite: Test depmod's -m flag
Link: https://github.com/kmod-project/kmod/pull/100
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-10 13:25:46 -05:00
Lucas De Marchi
5b082f6e0a meson: Stop rebuilding modules over and over
Instead of removing the sources every time and rebuilding, just use
rsync to preserve the timestamps and allow Make to do its job of
rebuilding if it changed.

There's a bug in meson that keeps building the testsuite even outside of
`ninja test`, but if the build result is cached, we can greatly minimize
the impact for developers.

Closes: https://github.com/kmod-project/kmod/issues/119
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/121
2024-09-09 11:05:54 -05:00
Lucas De Marchi
63167dc945 scripts: Make build-scdoc.sh executable
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 14:47:36 -05:00
Lucas De Marchi
0bd6f4f4cd meson: normalize s/check/test/
The testsuite is executed by calling the 'test' target in meson, as
opposed to 'check' with autotools. Let's normalize it aligned to the new
build system.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 14:46:28 -05:00
Emil Velikov
41c799c844 meson: add test for gtkdoc coverage
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/94
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-06 14:38:27 -05:00
Emil Velikov
25206a6001 meson: allow building the manpages
Not as brief as the pipeline and pattern matching that (auto)make can
do, although it's fully functional ;-)

v2:
 - move man/meson.build
 - move script under scripts/

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:54 -05:00
Emil Velikov
a6f4723241 meson: add support for the tools
Nothing too spectacular, apart from a few meson quirks:
 - one can use both_libraries() alas, "install: true" will also install
   the static library, which we do not want
 - need to workaround kmod.pc empty variables, introduced in 1.4.0
 - wrapper script is needed for the symlink creation - see wrapper
   script for details
 - resulting binary exports optarg/optind/stderr/stdout and more

v2:
 - add kmod bash-completion hunk

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:54 -05:00
Emil Velikov
59f40b8225 testsuite: split out setup-modules.sh
So that we can reuse it from the upcoming meson build.

v2:
 - shellcheck fixes, add TODO, move to scripts/

v3:
 - set MAKEFLAGS="-j$(nproc)" if empty

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:16 -05:00
Emil Velikov
be7a4bee3c testsuite: move setup-rootfs.sh to scripts/
There will be a few more scripts incoming, so let's give them a
dedicated location.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/86
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2024-09-02 20:13:16 -05:00