Commit Graph

207 Commits

Author SHA1 Message Date
Lucas De Marchi
0de690c96c testsuite: check if rootfs dir is dirty before running
Keep around a stamp-rootfs file that is generated together with the
rootfs. testsuite checks each test directory if its mtime is greater
than stamp's mtime, deciding if rootfs should be re-generated.
2012-06-05 00:54:47 -03:00
Lucas De Marchi
e2ee7d9b7a testsuite: rename rootfs dir 2012-06-05 00:54:47 -03:00
Lucas De Marchi
851ee75c19 build-sys: provide --sysconfdir to make distcheck flags
test-blacklist is accessing the wrong location in make distcheck, making
the test to fail. Fix is by providing --sysconfdir=/etc in configure
flags.
2012-06-05 00:54:46 -03:00
Dan McGee
c88aec70d1 test-conversion: convert test-get-dependencies to new infrastructure
The test uses the ext4 module dependencies as the testcase, checking
both the number and the names of the returned modules.
2012-05-11 08:44:55 -03:00
Dan McGee
bcca1b95d2 test-conversion: convert test-blacklist to new infrastructure
Add a modprobe.conf with some blacklist entries in a test rootfs, and
then ensure our blacklist function actually cuts out the two listed
entries (and doesn't cut out the others).
2012-05-11 08:44:55 -03:00
Lucas De Marchi
452c1dde2f build-sys: copy rootfs to another directory
We can't use the rootfs directory because it breaks out-of-tree build
and in future we want to make modifications to the fake filesystem such
as adding and removing files.

We need to call "chmod -R +w" in the resulting directory because when we
distribute the source with make dist all files will be readonly.

Fix 'make distcheck'
2012-05-11 02:23:34 -03:00
Lucas De Marchi
9c41596ecc build-sys: distribute testsuite
Fix 'make dist'
2012-05-11 01:21:46 -03:00
Dan McGee
cdbcc2481c testsuite: ship testsuite/rootfs unzipped
The current configuration is dumb in any number of ways:
1) If the rationale was for space savings, it works the opposite- the
   git repo gets more bloated because we are adding binary compressed
   blobs that share little in common with their parent, and anyone that
   wants to run the test suite has to unzip it anyway.
2) It is a pain in the butt to add new tests, and not accidentally lose
   any new rootfs you built in the directory.
3) `git status` won't help you if you are tweaking files in the rootfs
   and don't know they have been changed, or if some test did that and
   you couldn't detect it.
4) `git log` won't help you find out what is changing in the rootfs test
   directory itself when changes are made to the binary blob, such as
   new files being added or even existing files being tweaked.
5) The files just aren't that big anyway- 2.7MB unzipped.
2012-05-11 01:03:17 -03:00
Lucas De Marchi
46684bc2d9 kmod 8 2012-04-19 11:21:00 -03:00
Lucas De Marchi
8885ced062 kmod 7 2012-03-19 08:23:14 -03:00
Lucas De Marchi
e48f37657d build-sys: don't set CFLAGS and LDFLAGS
These variables are supposed to be set by user. What we can do in
configure is to set another variable and AC_SUBST() it. Then in
Makefile.am we assign it to AM_{CFLAGS,LDFLAGS}. This way user can
always override their values, in configure or make phase.

Reference: http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
2012-03-19 01:17:05 -03:00
Lucas De Marchi
26906fe73e kmod 6 2012-03-02 22:34:36 -03:00
Lucas De Marchi
bb05bc8ac1 Move repository to kernel.org 2012-02-24 01:58:20 -02:00
Lucas De Marchi
995627d04e build-sys: add rule to pack rootfs 2012-02-08 02:04:10 -02:00
Lucas De Marchi
976ea8c3ae testsuite: add tests to modprobe --show-depends
test 1 - check whether modprobe outputs the right thing when
using --show-depends is used with already loaded modules.

test 2 - check whether modprobe outputs the right thing when
using --show-depends with modules not loaded yet
2012-02-08 02:04:10 -02:00
Dan McGee
d35e8832a6 testsuite: libtestsuite depends on individual components
Ensure this dependency is explicit in the Makefile so rebuilding just
one test works correctly. Also reduce some repetition in the test LDADD
bits by adding a new TESTSUITE_LDADD variable.
2012-02-07 10:08:58 -02:00
Lucas De Marchi
e479598b7d kmod 5 2012-02-06 20:34:33 -02:00
Lucas De Marchi
a9474303a4 testsuite: add test for kmod_module_new_from_name()
Check if module names are being correctly normalized.
2012-01-30 20:05:34 -02:00
Lucas De Marchi
d48b8a792d build-sys: fix make dist 2012-01-30 13:52:07 -02:00
Dave Reisner
5ac788879b build-sys: declare rootfs.tar.xz as dep of rootfs/
This forces make to re-extract the tarball when it's changed
2012-01-30 13:52:07 -02:00
Pedro Pedruzzi
760b8968d4 testsuite: add test for function alias_normalize 2012-01-28 12:18:58 -02:00
Lucas De Marchi
5ac9c07aac build-sys: extract rootfs for make check
Commit "d2c2b8b build-sys: autotoolify build of check libraries" removed
rootfs extraction. Add it back.
2012-01-26 19:26:35 -02:00
Lucas De Marchi
f6ef5d6b5f testsuite: trap calls to delete_module() including simple test 2012-01-26 16:14:18 -02:00
Lucas De Marchi
d2c2b8b500 build-sys: autotoolify build of check libraries
Many thanks to Iván Briano (sachieru@gmail.com) for pointing out this
thread in libtool mailing list:
	http://www.mail-archive.com/libtool@gnu.org/msg09627.html

Passing '-rpath /nowhere' in LDFLAGS we are able to create shared libs
that are not installed.
2012-01-26 16:05:05 -02:00
Lucas De Marchi
53646fc56f testsuite: add trap to init_module() including simple test 2012-01-26 16:05:05 -02:00
Lucas De Marchi
95daea07f4 testsuite: add test for modinfo
These ext4 modules were sent by Jon Master so we can test the result of
modinfo with modules generated for different architectures.

They are now added to testsuite and their output tested automatically.
2012-01-26 16:05:05 -02:00
Lucas De Marchi
61e9433f7c testsuite: add simple test for list of loaded modules 2012-01-26 16:05:05 -02:00
Lucas De Marchi
6b88ef3e97 testsuite: allow to run tests outside of top_buildir
In order to locate where the shared libs to be preloaded are we need to
reference them using abs_top_buildir. Otherwise we are limited to
running tests from there.
2012-01-26 16:05:04 -02:00
Lucas De Marchi
6afc9cd616 testsuite: add trap to fopen() including tests 2012-01-26 16:05:04 -02:00
Lucas De Marchi
ab25311072 testsuite: fake kernel 4.0.20-kmod is out
Go get it while it's fresh :-). Test fake results of "uname -r" by
LD_PRELOAD'ing uname.so.
2012-01-26 16:05:04 -02:00
Lucas De Marchi
68cc449376 testsuite: trap calls to uname 2012-01-26 16:05:04 -02:00
Lucas De Marchi
eebca81e94 testsuite: test libkmod initialization 2012-01-26 16:05:04 -02:00
Lucas De Marchi
80f9e02382 testsuite: add skeleton 2012-01-26 16:05:04 -02:00
Lucas De Marchi
fe8b0671a0 build-sys: do not create symlinks by default
Distro packagers should create them instead. It's too much trouble to
create them in the build system and every distro wants a different path
for them.
2012-01-21 18:01:00 -02:00
Lucas De Marchi
12fd9cd55c build-sys: forcefully create links
If link already existed we would fail. Really not important for
packagers (the link should not exist), but for those who manually install it.
2012-01-18 19:48:16 -02:00
Lucas De Marchi
1592b0efdf build-sys: move modprobe to sbindir 2012-01-18 19:48:16 -02:00
Lucas De Marchi
411d83c41e Add program to calculate the shortest relative path for symlinks 2012-01-18 19:48:16 -02:00
Lucas De Marchi
7bbf52341f build-sys: create symlinks if we are installing tools 2012-01-17 19:33:32 -02:00
Lucas De Marchi
b53b7e3282 kmod 4 2012-01-16 16:53:04 -02:00
Lucas De Marchi
f4647b6329 build-sys: add release helpers 2012-01-16 16:52:25 -02:00
Lucas De Marchi
904b57d022 build-sys: build man pages 2012-01-12 14:21:22 -02:00
Lucas De Marchi
efd2cec66e test: add check of module's state 2012-01-11 21:22:21 -02:00
Lucas De Marchi
39baaec11b build-sys: fix build with zlib/xz after private lib 2012-01-10 16:22:59 -02:00
Lucas De Marchi
0b22179acd build-sys: workaround libtool issue with argv[0]
Symlinking tools to kmod doesn't work because argv[0] is not the name of
the symlink, but rather 'kmod' (since libtool's wrapper script calls the
tools/.libs/kmod directly)

Now we create another binary kmod-nolib that is statically linked to
libkmod so we can call the binary directly and do not worry about
LD_LIBRARY_PATH.
2012-01-10 15:31:58 -02:00
Lucas De Marchi
043b3f9833 build-sys: build tests as part of check phase
Do not unconditionally compile tests, make them as target of 'make
check'. Only those listed in TESTS var are run.
2012-01-10 15:31:58 -02:00
Lucas De Marchi
00fc926cd8 build-sys: create symlinks instead of building separate tools 2012-01-10 15:31:58 -02:00
Lucas De Marchi
646b83b841 doc: add gtk-doc to generate documentation
Current limitation is horrible no support to sections: we have to to
have separate header files or to maintain the libkmod-sections.txt file.
We are doing the latter.
2012-01-09 05:28:57 -02:00
Lucas De Marchi
b30a71b8e8 kmod 3 2012-01-05 08:16:28 -02:00
Lucas De Marchi
8d75053eb7 build-sys: do not install kmod-* tools 2012-01-04 08:58:19 -02:00
Lucas De Marchi
51e873d1b9 Add test to check kmod_validate_resources 2012-01-01 06:18:16 -02:00
Lucas De Marchi
0c010fae10 Move libkmod-util.c to convenience util lib
Share more code between tools and libkmod. underscores() in kmod-depmod
can not use the same function as in the lib, so rename it.
2011-12-28 13:33:26 -02:00
Lucas De Marchi
6670c63344 Move array implementation from depmode to libkmod-util 2011-12-28 12:58:47 -02:00
Lucas De Marchi
f6cf14ce13 tools: kmod: bundle depmod together with the others 2011-12-27 19:56:33 -02:00
Lucas De Marchi
a4848e249f Move util functions to libkmod-util.c
These allow them to be later shared with tools.
2011-12-27 18:11:58 -02:00
Lucas De Marchi
5cd13064ec kmod-depmod: use hash implementation from util lib 2011-12-27 18:11:58 -02:00
Lucas De Marchi
529148ea70 build-sys: create libkmod-util.la convenience lib
Util functions can be shared betweeing libkmod and tools. Start with the
hash implementation.
2011-12-27 18:11:58 -02:00
Gustavo Sverzut Barbieri
64b8b586eb kmod-depmod: initial code (no files generated, untested)
this is the initial code for depmod, it should:
 * use configuration from /run/depmod.d, /etc/depmod.d, /lib/depmod.d
 * respect overrides and searches
 * resolve symbols and dependencies
 * break circular dependencies (dependency loops)
 * --errsyms: print out modules with unresolved symbols and incorrect crc
 * --symbol-prefix: respect architecture symbol prefix

it will not:
 * --quick: does not do quick mode
 * --warn: does not warn on duplicates
 * --filesyms: does not load symbols from map file
 * --symvers: does not load symbol versions from map file
 * dump files: does not dump any files at the moment.

it is highly untested, then I appreciate your help with real world
scenarios using overrides and searches. To get output run with -vvvvvv.

next version should fill in the gaps and at least generate the files
2011-12-27 12:09:16 -02:00
Lucas De Marchi
9190c8cda8 Add test for probe insert 2011-12-27 11:55:22 -02:00
Lucas De Marchi
9b0e5926fa build-sys: remove unneeded _SOURCES var 2011-12-27 02:49:46 -02:00
Lucas De Marchi
7adfd2c36d Merge branch 'master' of git://dev.medozas.de/libkmod 2011-12-24 17:39:44 -02:00
Jan Engelhardt
b182f8fb5e Support for loading Xz-compressed modules 2011-12-24 20:26:22 +01:00
Jan Engelhardt
7b3a74fc67 build: use pkgconfig to detect zlib
build: explicitly call PKG_PROG_PKG_CONFIG

Per the manual page, PKG_PROG_PKG_CONFIG needs to be invoked
explicitly if PKG_CHECK_MODULES might not happen (it is indeed stowed
in an AS_IF in kmod). Without this, funny failures can occur.
(As it did.)
2011-12-24 20:25:21 +01:00
Gustavo Sverzut Barbieri
f85ae0d598 add test/test-elf
will be focused on testing ELF operations and takes a filename to load
instead of looking for it in the system.
2011-12-24 01:44:31 -02:00
Lucas De Marchi
fa29c0ee96 tools: kmod: Add handling of compat modprobe 2011-12-23 03:09:05 -02:00
Lucas De Marchi
769becb5db tools: kmod: Add handling of compat modinfo 2011-12-23 03:09:05 -02:00
Lucas De Marchi
ad6026965f tools: kmod: Add handling of compat insmod 2011-12-23 03:09:05 -02:00
Lucas De Marchi
f712ebc429 tools: kmod: Add handling of compat rmmod 2011-12-23 03:09:05 -02:00
Lucas De Marchi
6fcf69e62b tools: kmod: Add handling of compat lsmod 2011-12-23 03:09:05 -02:00
Lucas De Marchi
8900b9166b tools: add skeleton of kmod tool
If using libtool 2.4.2, running the script generated by libtool will not
work because libtool changes argv[0] to lt-progname.

To test this is necessary to either fix the installed
build-aux/ltmain.sh file or run the binary directly like in:

$ export LD_LIBRARY_PATH=$PWD/libkmod/.libs/
$ ./tools/.libs/kmod help
2011-12-23 03:01:58 -02:00
Lucas De Marchi
6a4fa8d8f1 build-sys: use MKDIR_P 2011-12-23 01:59:31 -02:00
Kay Sievers
e79bf83b06 introduce --with-rootlibdir=DIR
Support the installation of the shared library in the rootfs --rootlibdir=,
while the development symlink stays in --libdir=.
2011-12-22 19:08:04 -02:00
Kay Sievers
9faa7b376c do not (mis-)use the config file generator for non-autobuild stuff
"Similarly, you should not rely on AC_CONFIG_FILES to replace bindir
and friends in your shell scripts and other files; instead, let make
manage their replacement."

http://www.gnu.org/software/autoconf/manual/autoconf.html#Makefile-Substitutions
2011-12-21 11:50:04 -02:00
Lucas De Marchi
acc18b1451 kmod 2 2011-12-20 23:48:46 -02:00
Lucas De Marchi
9ce0966197 build-sys: remove remaining _SOURCES var 2011-12-20 16:57:11 -02:00
Kay Sievers
a308abec37 introduce --with-rootprefix=DIR
Configure the location of the rootfs directories and use it
to find (/usr)/lib/modules and (/usr)/lib/modprobe.d.
2011-12-20 16:22:07 -02:00
Lucas De Marchi
0eae38e6cf build-sys: remove unneeded _SOURCES vars 2011-12-20 03:27:50 -02:00
Gustavo Sverzut Barbieri
0cc3ccfd52 Introduce kmod-modinfo. 2011-12-19 15:06:49 -02:00
Gustavo Sverzut Barbieri
708624a4eb ELF: initial support for modinfo and strip of modversions and vermagic.
Needs testing, but should work.
2011-12-19 15:06:49 -02:00
Gustavo Sverzut Barbieri
3d8226edfe implement zlib module loading. 2011-12-17 19:43:11 -02:00
Lucas De Marchi
89eba7cb77 kmod 1 2011-12-15 15:43:58 -02:00
Lucas De Marchi
e269a84cab Add libkmod files to EXTRA_DIST 2011-12-15 15:40:22 -02:00
Lucas De Marchi
0283d6b666 build-sys: add version map file to build dependencies
Based on original patch from Jan Engelhardt <jengelh@medozas.de> to
libabc.
2011-12-12 17:06:15 -02:00
Lucas De Marchi
49ce6d0741 Remove libkmod-loaded.c and re-order functions in libkmod-module.c
It's not possible to move functions related to "live" modules to
libkmod-loaded.c because they depend on the definition of kmod_module.
Putting this structure in the private header is not a good idea, so let
all functions related to "live" information in the end of
libkmod-module.c, and move the sole function from libkmod-loaded.c to
this place. This way all functions get the right documentation
about their sections.
2011-12-12 13:56:47 -02:00
Gustavo Sverzut Barbieri
c3d0a5f2ef tools: add modprobe
try to mimic original module-init-tools' modprobe as much as possible,
but this exposed some missing features in libkmod, these are now
listed in TODO.
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
72c51a9e4d add lsmod, insmod and rmmod tools.
these tools are compatible with module-init-tools (except insmod does
not take data from stdin).
2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
1487a64ffa add kmod_module_get_filtered_blacklist()
This function will filter the given list against the known blacklist,
returning a new list with remaining modules with the reference
incremented.
2011-12-08 11:17:16 -02:00
Lucas De Marchi
fab4978ac1 test: add test for modules' hash 2011-12-06 03:49:30 -02:00
Lucas De Marchi
1843b153b4 test: add test to get dependencies of a module 2011-12-06 03:34:51 -02:00
Lucas De Marchi
c5b5ea9c7c test: add test to convert name to path
If we create a kmod_module from a name, the path returned is relative to
the module dirname, as passed during kmod_ctx creation. Note that if
kmod_ctx is created with kmod_new(NULL), the dir used is the one
returned by uname.
2011-12-06 03:34:51 -02:00
Gustavo Sverzut Barbieri
7db08652cd Add simple hash implementation 2011-12-05 19:24:06 -02:00
Lucas De Marchi
85ece2042f Do not ship autogen.sh in the tarball
Copied from libabc.
2011-12-02 17:54:42 -02:00
Lucas De Marchi
aed94cd72a Add test for lookup function 2011-11-30 19:10:48 -02:00
Lucas De Marchi
e8847fd2fc Import index handling from module-init-tools
This effectively makes the combined work be GPL. All other parts of this
library are still LGPL and if this part in future becomes
double-licensed, we can switch back to LGPL.
2011-11-30 15:23:49 -02:00
Lucas De Marchi
7c2ab358fd Add support for parsing config files
Right now only alias keyword is treated.
2011-11-29 18:07:43 -02:00
Lucas De Marchi
4462c4ac60 Add getline_wrapped() to parse config files
Basically copied from module-init-tools
2011-11-29 18:05:43 -02:00
Lucas De Marchi
a5494f831f Add test-insmod to insert modules
Insmod is supported only with file names yet.
2011-11-25 01:25:18 -02:00
Lucas De Marchi
b84a206085 Add test-rmmod2
Remove module without dealing with the loaded modules first.
2011-11-25 01:24:16 -02:00
Lucas De Marchi
8f788d58c3 Add functions to operate on modules 2011-11-25 01:22:56 -02:00
Lucas De Marchi
46cfa8dc45 Fix check_PROGRAMS in autofoo 2011-11-25 01:21:47 -02:00
Lucas De Marchi
eee1345cf2 Add binary to test rmmod feature
It doesn't run with `make check' since
	o It's dangerous
	o It needs to be run as root
	o It needs an argument, otherwise it removes the first module
	  with use_count==0
2011-11-23 17:22:09 -02:00
Lucas De Marchi
88e9c12e4e Rename libkmod-util.h to macro.h 2011-11-23 16:08:04 -02:00
Lucas De Marchi
5369797d09 Add libkmod-loaded to handle live modules information
All the functions needed by a lsmod binary are in place.
test/test-loaded.c implements it with the same output of lsmod.
2011-11-23 11:44:17 -02:00
Lucas De Marchi
6924e47a8d Implement circular double-linked list 2011-11-23 05:15:21 -02:00
Lucas De Marchi
be0e323604 Put test back 2011-11-22 17:47:52 -02:00
Lucas De Marchi
c83a45ea87 Fix version to 0:0:0
Version is only incremented upon release
2011-11-22 05:36:50 -02:00
Lucas De Marchi
586fc304d8 Rename libabc to libkmod 2011-11-21 14:35:35 -02:00
Lucas De Marchi
ecd40ee499 Import skeleton from libabc 2011-11-21 12:35:15 -02:00