Commit Graph

24 Commits

Author SHA1 Message Date
Lucas De Marchi 3d38e322f9 testsuite: Handle different sysconfdir
Instead of skipping tests if sysconfdir isn't /etc, just handle it
during the rootfs setup logic.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2023-02-10 14:29:28 -08:00
Emil Velikov 96152dd687 testsuite/depmod: use defines for the rootfs/lib_modules
The uname used across the tests is same, so drop "_ORDER" from the macro
name and use it throughout. Similarly - add respective LIB_MODULES
defines and use them in the tests.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2023-02-09 11:11:40 -08:00
Emil Velikov 1712a1548e depmod: Introduce outdir option
This option is equivalent to basedir, with the small difference being
that's where the meta-data files are generated. In other words, this
allows us to have read-only input modules and modules.dep, while still
being able to generate the meta-data files.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
[ Move files to a different dir so input files (produced by kernel build
  system is separate from the files generated by depmod (output) ]
Signed-off-by: Lucas De Marchi <lucas.demarchi@gmail.com>
2023-02-09 07:09:06 -08:00
Lucas De Marchi 1921c370c2 testsuite: compress modules if feature is enabled
Since the output needs to be the same, regardless if the module is
compressed, change populate-modules.sh to conditionally compress the
module if that feature is enabled.

This way we can execute the tests with any build-time configuration and
it should still pass.

Suggested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Michal Suchánek <msuchanek@suse.de>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
2021-02-05 19:52:00 -08:00
Marius Bakke 847247a4a8 testsuite: Automatically skip tests that fail when sysconfdir != /etc. 2021-01-07 19:44:50 -08:00
Yauheni Kaliuta 809b9fb6cf testsuite: depmod: add override test
Simple test to check if depmod honors override keyword. Uses
mod-simple.ko for foo/ and override/ directories, search.conf to
search in foo and built-in and simple override configuration:

override mod-simple 4.4.4 override

The resulting modules.dep should point to the override directory.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2017-12-07 13:08:00 -08:00
Yauheni Kaliuta df492f5ca3 testsuite: add tests for external directory support
The following tests added:

- depmod_search_order_external_first -- checks if external module
  is taken in use when it has higher priority;
- depmod_search_order_external_last -- checks if external module
  is skipped when it has lower priority;
- test_modinfo_external -- checks if modinfo is able to look up
  correct external module;
- modprobe_external -- checks if modprobe is able to look up
  correct external module and loads it.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
2017-06-01 20:31:37 -07:00
Lucas De Marchi e0ff310d87 test-depmod: avoid warning when we don't have zlib
testsuite/test-depmod.c:31:21: warning: ‘depmod_modules_order_for_compressed’ defined but not used [-Wunused-function]
 static noreturn int depmod_modules_order_for_compressed(const struct test *t)
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-06-01 20:26:23 -07:00
Lucas De Marchi 2a38870e3d testsuite: port modules-order-compressed to module-playground 2015-02-19 19:50:16 -02:00
Lucas De Marchi dea2dfee9b Remove FSF mailing address
It has changed in the past, and these days, anyone can get a copy of the
LGPL via the web rather than by post.

Like 657a122 (Remove FSF mailing address) in libabc by Josh Tripplet,
but let the FSF website in which the license can be found.
2014-12-25 23:41:34 -02:00
Lucas De Marchi 4328982058 testsuite: remove now unused array of tests
Remove the arrays and let each test with a guaranteed unique name.
2014-10-09 14:29:04 -03:00
Lucas De Marchi f1155c1574 Move static keyword to DEFINE_TEST macro 2014-10-09 13:00:30 -03:00
Lucas De Marchi c2e4286bb9 Reorder and reorganize header files
Let the includes in the following order:

< system headers >
< libkmod >
< tool >
< local headers >
2014-10-03 01:43:15 -03:00
Lucas De Marchi 7a2d0e6187 testsuite: check for correct error message in detect-loop 2014-05-30 10:26:17 -03:00
Lucas De Marchi 8183cfa9da testsuite: add test to fail depmod on module loops 2014-05-30 09:36:56 -03:00
Lucas De Marchi 3e68b2c455 testsuite: Remove duplicate test
This partially reverts ad7f175 ("Add test for depmod using search dirs
with same prefix"). Testing it twice in the inverted order doesn't
ensure we get the bug with wrong ordering.

As put by Anssi Hannula <anssi@mageia.org>:

	So the bug is triggered only if the shorter name is higher-prio _and_
	shorter name is traversed first. If the long name is traversed first,
	the bug don't trigger with either "search" directive order (and on my
	"make check" runs this is the case).
2014-04-06 17:46:45 -03:00
Michal Marek 81bf88d6c4 testsuite: Do not run tests with *.ko.gz if zlib is not enabled 2014-04-04 13:05:49 +02:00
Lucas De Marchi ad7f1757c0 Add test for depmod using search dirs with same prefix
Test depmod with search dirs "foo" and "foobar". Previously to 49b33c1
("depmod: do not allow partial matches with "search" directive") we were
failing this test due to matching the prefix without checking if
it's the full dir name.

We are adding 2 tests here in order to catch the case we only pass the
test due to processing the directories in a favourable order.
2014-03-19 09:22:20 -03:00
Lucas De Marchi aa0abec721 Add test for simple search order in depmod 2014-03-19 08:52:33 -03:00
Lucas De Marchi d96ca9c429 Use C11's noreturn
Also define noreturn w/o <stdnoreturn.h> and move it to macro.h instead
of in the testsuite.

Based on similar commit on systemd by Shawn Landden
<shawn@churchofgit.com>.
2013-12-17 19:10:16 -02:00
Lucas De Marchi b6adccd6ff tools: Do not link dynamically with libkmod
Instead of linking dynamically with libkmod, use libkmod-private.la. We
disallow creating a static libkmod because we can't hide symbols there
and it cause problems with external programs. However this should not
prevent users that are only interested in the tools we provide not being
able to ship only them keeping the library alone.

Other projects also do this to allow our tools to use certain functions
that should not be used outside of the project.
2013-07-04 16:08:10 -03:00
Lucas De Marchi 9de9e07da6 tools: Use test/kmod instead of kmod-nolib
The reason to have a kmod-nolib binary is that we need to call kmod on
test cases (or a symlink to it) and for testing things in tree. Since
we are using libtool if we are dinamically linking to libkmod what we
end up having is a shell script that (depending on the version *)
changes argv[0] to contain an "lt-" prefix. Since this screws with our
compat stuff, we had a kmod-nolib that links statically.

This all workaround works fine iff we are using one of the compat
commands, i.e. we are using the symlinks insmod, rmmod, modprobe, etc.
However if we are actually trying the kmod binary, this doesn't work
because we can't create a kmod symlink since there's already a kmod
binary.

So, completely give up on libtool fixing their mess. Now we create a
tool/test/ directory and the symlinks and kmod is put there.

* http://lists.gnu.org/archive/html/bug-libtool/2011-12/msg00023.html
2013-07-02 21:15:54 -03:00
Lucas De Marchi e6b0e49b4e Update copyright notices 2013-01-16 11:27:45 -02:00
Lucas De Marchi b0c9fc85a2 testsuite: add depmod test for modules.alias
Check if modules.alias is correctly generated from modules.order if we
have compressed modules.
2012-10-04 01:08:13 -03:00