kmod/testsuite
2019-11-06 23:37:34 -08:00
..
mkosi testsuite: mkosi: update files 2019-02-04 16:09:38 -08:00
module-playground testsuite: update gitignore 2019-11-06 23:37:34 -08:00
rootfs-pristine testsuite: fix modinfo test without openssl 2019-02-04 14:25:03 -08:00
.gitignore Add scratchbuf implementation 2016-08-15 10:26:42 -03:00
COPYING testsuite: re-license under LGPL 2012-07-10 10:31:57 -03:00
delete_module.c testsuite: fix retcodes parsing 2015-01-14 14:25:02 -02:00
init_module.c testsuite: also wrap gettid in syscall() 2018-01-08 13:32:38 -08:00
Makefile build-sys: add small redirecting Makefiles 2014-03-06 01:59:58 -03:00
path.c testsuite: do not overrid paths inside build 2015-01-07 19:14:20 -02:00
populate-modules.sh testsuite: add modinfo pkcs7 signature test 2019-02-04 13:49:13 -08:00
README Remove bootstrap* scripts 2018-12-17 09:52:05 -08:00
stripped-module.h Use #pragma once instead of #ifndef 2012-07-18 10:31:50 -03:00
test-array.c testsuite: fix test_array_sort pointers inderection 2016-11-08 22:21:13 -02:00
test-blacklist.c testsuite: move test-blacklist to DEFINE_TEST 2015-02-22 13:46:18 -03:00
test-dependencies.c testsuite: port test-dependencies to module-playground 2015-02-03 01:12:13 -02:00
test-depmod.c testsuite: depmod: add override test 2017-12-07 13:08:00 -08:00
test-hash.c testsuite: add test for growing then shrinking a hash 2015-01-21 10:17:27 -02:00
test-init.c testsuite: convert test-init function to use mod-simple.ko 2015-02-03 05:19:38 -02:00
test-initstate.c testsuite: test builtin state 2015-02-28 14:18:54 -03:00
test-list.c testsuite: add tests for kmod_list 2015-01-26 19:20:51 -02:00
test-loaded.c Fix includes after change to build-sys 2015-01-02 12:41:01 -02:00
test-modinfo.c testsuite: fix modinfo test without openssl 2019-02-04 14:25:03 -08:00
test-modprobe.c testsuite: move --show-exports test to use regex 2019-01-03 12:43:18 -08:00
test-new-module.c Fix includes after change to build-sys 2015-01-02 12:41:01 -02:00
test-scratchbuf.c Add scratchbuf implementation 2016-08-15 10:26:42 -03:00
test-strbuf.c testsuite: prefer the use of streq() 2015-01-14 14:32:09 -02:00
test-testsuite.c util: fix warning of equal values on logical OR 2016-08-10 12:45:36 -03:00
test-tools.c tools: add basic versions of insert and remove 2015-03-07 12:09:51 -03:00
test-util.c shared: add helper function to add and check for overflow 2015-02-10 10:43:44 -02:00
testsuite.c testsuite: factor out fd related parameters to a structure 2019-01-04 14:39:39 -08:00
testsuite.h testsuite: add support for testing output against regex 2019-01-03 12:43:18 -08:00
uname.c Remove FSF mailing address 2014-12-25 23:41:34 -02:00

testsuite

OVERVIEW
========

Kmod's testsuite was designed to automate the process of running tests with
different scenarios, configurations and architectures. The idea is that once we
received a bug report, we reproduce it using the testsuite so we avoid
recurring on the same bug in future.


FEATURES
========

- Isolate each test by running them in separate processes;
- Exec a binary, so we can test the tools and not only the lib API
- Fake accesses to filesystem so we can provide a test rootfs with all the
  configuration, indexes, etc that test needs to be executed.
- Fake calls to init_module(), delete_module() and uname(), so we don't have to
  run tests as root and figure out how to deal with different architectures.

HOW TO ADD A TEST
=================

The simplest way to add a test is to copy and paste one already there. Most of
the options you can have are covered by another tests. This is what you need to
pay attention when writing a test:

1 - Look at testsuite.h, struct test, to see all the options available.

2 - Use TESTSUITE_MAIN and DEFINE_TEST to add new tests. Don't forget to fill
    its description.

3 - If you want testsuite to compare the stdout/stderr of your tests in order
    to check if it worked or not, fill in output.{stderr,stdout} the file with
    the expected output. Bear in mind the same file is used for all
    architectures, so don't print arch-dependent content if you are comparing
    the output.

4 - Fill in the config vector. Setting any of these configuration will make
    testsuite to export LD_PRELOAD with the necessary override libs before
    executing the test. If you are not exec'ing an external binary, you need to
    pass "need_spawn = true" below, otherwise it will not work (LD_PRELOAD is
    only applied when exec'ing a binary). See each config description in
    testsuite.h

5 - need_spawn: if testsuite will exec itself before running a test

6 - expected_fail: if that test is expected to fail, i.e. the return code is
    expected not to be 0.

7 - The rootfs is populated by copying the entire contents of rootfs-pristine
    then running populate-modules.sh to copy generated modules from
    module-playground. Update the latter script to include any modules your
    test need.

8 - Tests can be run individually, outside of 'make check'. strace and gdb work
    too, as long as you tell them to operate on child process.

9 - Make sure test passes when using "default" build flags, i.e. by running
    'autogen.sh c'