Commit Graph

43 Commits

Author SHA1 Message Date
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
abb7e4706d test: remove test-state
This test is already covered by testsuite/test-loaded.
2012-02-09 01:44:09 -02:00
Lucas De Marchi
54c43dff1b Add WARNING file for test dir and improve testsuite README 2012-02-06 19:52:58 -02:00
Dan McGee
2efd5d4c1a test-conversion: remove test/test-{insmod,rmmod,rmmod2}
These are covered by the various test cases in testsuite/test-init.
2012-02-05 02:15:48 -02:00
Dan McGee
2af31a5dbb test-conversion: remove test/test-init
This was already converted to testsuite/test-init.
2012-02-05 02:15:44 -02:00
Dan McGee
6fc9458f58 test-conversion: remove test/test-loaded
This was already converted to testsuite/test-loaded.
2012-02-05 02:15:35 -02:00
Lucas De Marchi
80f9e02382 testsuite: add skeleton 2012-01-26 16:05:04 -02:00
Lucas De Marchi
efd2cec66e test: add check of module's state 2012-01-11 21:22:21 -02:00
Lucas De Marchi
51e873d1b9 Add test to check kmod_validate_resources 2012-01-01 06:18:16 -02:00
Lucas De Marchi
9190c8cda8 Add test for probe insert 2011-12-27 11:55:22 -02:00
Gustavo Sverzut Barbieri
674f8590e3 elf: implement kmod_module_get_dependency_symbols()
Uses kmod_elf_get_dependency_symbols() that looks into ".symtab" for
UNDEF symbols and matches the name from ".strtab" to "__versions" to
get crc.

Likely the public API should unify the symbol information getters and
list release, they are almost the same.
2011-12-24 01:44:31 -02: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
Gustavo Sverzut Barbieri
45e6db9c01 elf: add get_symbols()
Similar to module-init-tools load_symbols(), it will try .symtab and
.strtab for symbols starting with __crc_, if they are found their crc
is read from ELF's Elf_Sym::st_value.

If not found, then it will fallback to __ksymtab_strings.
2011-12-24 01:44:31 -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
Lucas De Marchi
b6ea28dda4 Fix leak of kmod_module 2011-12-18 01:35:30 -02:00
Gustavo Sverzut Barbieri
1c52260048 implement softdeps. 2011-12-17 19:43:11 -02:00
Lucas De Marchi
22907a188c Improve test of double references 2011-12-15 13:49:13 -02:00
Lucas De Marchi
25c0543ff6 Remove function kmod_resolve_alias_options()
Remove function kmod_resolve_alias_options since it's not needed
anymore. Test is using the following configuration file:

alias blablabla ac
options ac test=1
options blablabla test=2

Lookup test by module name:
	$ ./test/test-lookup ac
	libkmod version 1
	Alias: 'ac'
	Modules matching:
		ac
			options: 'test=1'

Lookup test by alias:
	$ ./test/test-lookup blablabla
	libkmod version 1
	Alias: 'blablabla'
	Modules matching:
		ac
			options: 'test=1 test=2'
2011-12-13 14:28:16 -02:00
Lucas De Marchi
1c250ec150 Fix "Dead assignments" as reported by llvm 2011-12-12 18:36:27 -02:00
Lucas De Marchi
2411c07794 Do not use config if it's not needed/wanted 2011-12-12 15:41:02 -02:00
Lucas De Marchi
a102e262e6 Rename kmod_loaded_get_list() to kmod_module_new_from_loaded()
Be consistent with other similar functions already present and improve
documentation.
2011-12-12 13:50:19 -02:00
Gustavo Sverzut Barbieri
cb8d4d3e99 API-BREAK: kmod_new() takes a second parameter for configuration directory.
This is required by modprobe and also to help doing unit tests in future.
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
3a721bbcf0 insmod: allows providing option to module. 2011-12-11 20:58:22 -02:00
Gustavo Sverzut Barbieri
bd3f553526 export module's options and commands.
This will be required to implement modprobe later. The implementation
follows "man modprobe.conf" and allows options to be specified for
alias as well, thus the need for kmod_resolve_alias_options().

Example mod-a.conf:

    options mod-a a=1 b=2
    options mod-a c=3
    alias mymod-a mod-a
    options mymod-a d=4

Results in:
    options mod-a a=1 b=2 c=3
    options mymod-a a=1 b=2 c=3 d=4

Install commands are being concatenated with ";", but manpage is not
clean about this behavior.
2011-12-11 20:58:21 -02:00
Gustavo Sverzut Barbieri
fe514b1ed0 test-lookup: allow loading resources for testing. 2011-12-10 10:28:11 -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
ac9f8761fe test-insmod: show the path libkmod is using 2011-12-08 11:15:24 -02:00
Gustavo Sverzut Barbieri
97a3ea9e9d test-insmod: print name to test modname_normalize(). 2011-12-08 11:15:24 -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
8226058343 tests: release memory before error exits.
this makes it easier to valgrind the error cases as well.
2011-12-05 01:45:21 -02:00
Gustavo Sverzut Barbieri
69f9dd4369 no more kmod_loaded and kmod_loaded_module.
kmod_loaded_get_list() now returns a regular list of kmod_modules, use
kmod_module_get_module(), kmod_module_unref() and
kmod_module_unref_list() to operate on it.
2011-12-04 17:24:08 -02:00
Lucas De Marchi
1fc1c9a06f Clean 'shadowed declaration' warnings 2011-12-02 10:00:03 -02:00
Lucas De Marchi
aed94cd72a Add test for lookup function 2011-11-30 19:10:48 -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
221631d511 Accept dir where we should lookup for modules 2011-11-24 23:20:42 -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
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
be0e323604 Put test back 2011-11-22 17:47:52 -02:00