1 module-init-tools coding standards
2 ----------------------------------
4 Patches to module-init-tools are welcome. Please note the following
7 1) insmod and rmmod are designed to be as simple as possible.
9 2) modprobe is designed to be a swiss-army-knife, but the config file
10 format is designed to be as simple as possible: let the user create
11 complexity if they wish. Having said that, the "install" and "remove"
12 commands serve as examples of what we don't want to do in the future,
13 due to the problems they cause with identifying module dependencies.
15 3) module-init-tools contains a testsuite. Patches which do not pass
16 the testsuite get a frowny face. It's easy to run the testsuite,
17 as you can see below. Please do test patches before posting.
22 The testsuite is under tests/test-*: one directory for each tool. To
23 run the testsuite, type the following from the top level directory:
27 To start the tests at a particular test, use that test name on the
28 command line, eg. "./tests/runtests 26blacklist.sh". To see exactly
29 what the test is doing, use -vv, eg
31 ./tests/runtests -vv 26blacklist.sh
33 To only test a given endianess or bitness, use
35 TEST_ENDIAN=32 TEST_BITS=le ./tests/runtests
37 Each test is a shell script run with "-e": ie. if any command fails,
38 the test will fail. The path is set up with special test versions of
39 the utilities (and possibly valgrind wrappers), so just invoke
40 "modprobe" etc. as normal. Environment variables can be used to
41 control normally hardwired behaviour:
44 The result "uname" is to return. Set to 2.6.27 by default.
46 2) $MODTEST_OVERRIDE<n>, $MODTEST_OVERRIDE_WITH<n>
47 These cause file operations on $MODTEST_OVERRIDE1 to occur on
48 $MODTEST_OVERRIDE_WITH1, etc. The numbers must be consecutive:
49 the code stops searching for a replacement when a number is not
50 found. This is used to stop the utilities looking in
51 /lib/modules/2.6.27/ for example.
53 Other environment variables can be found in testing.h.
55 There are various pre-compiled test modules under tests/data/. Each
56 one has big and little endian and 32 and 64-bit variants: modprobe
57 must handle both 32 and 64 bit (for x86-64, PPC64, Sparc64, IA64), and
58 depmod and modinfo must handle any endianness as well. If you need to
59 add a new module to test something, put the source under tests/src,
60 make sure it passes for the cases you can test, and I'll compile and
63 When writing tests, make sure your test aborts on any unexpected
64 behaviour: eg. compare the result is equal to what you expect, rather
65 than not equal to something.