kmod/testsuite
Lucas De Marchi 0db718edcf Move hash implementation to shared directory 2014-10-03 00:40:11 -03:00
..
module-playground Add gitignore to module playground 2014-05-09 08:43:32 -03:00
rootfs-pristine testsuite: check for correct error message in detect-loop 2014-05-30 10:26:17 -03:00
.gitignore testsuite: Add basic tests for hash implementation 2014-06-06 02:24:39 -03:00
COPYING testsuite: re-license under LGPL 2012-07-10 10:31:57 -03:00
Makefile build-sys: add small redirecting Makefiles 2014-03-06 01:59:58 -03:00
README build-sys: add rule to pack rootfs 2012-02-08 02:04:10 -02:00
delete_module.c Update copyright notices 2013-01-16 11:27:45 -02:00
init_module.c Move generic util functions to shared directory 2014-10-03 00:33:25 -03:00
path.c Update copyright notices 2013-01-16 11:27:45 -02:00
stripped-module.h Use #pragma once instead of #ifndef 2012-07-18 10:31:50 -03:00
test-blacklist.c Use "-internal" suffix instead of "-private" 2013-07-04 16:13:11 -03:00
test-dependencies.c Update copyright notices 2013-01-16 11:27:45 -02:00
test-depmod.c testsuite: check for correct error message in detect-loop 2014-05-30 10:26:17 -03:00
test-hash.c Move hash implementation to shared directory 2014-10-03 00:40:11 -03:00
test-init.c testsuite: Check the list of loaded modules after a test 2014-03-05 12:22:37 -03:00
test-loaded.c testsuite: fix usage of reserved names 2013-08-29 01:22:20 -03:00
test-modinfo.c Use C11's noreturn 2013-12-17 19:10:16 -02:00
test-modprobe.c testsuite: add test for '.' correctly parsed in param's value 2014-03-06 01:36:02 -03:00
test-new-module.c testsuite: fix usage of reserved names 2013-08-29 01:22:20 -03:00
test-testsuite.c Use C11's noreturn 2013-12-17 19:10:16 -02:00
test-util.c Move generic util functions to shared directory 2014-10-03 00:33:25 -03:00
testsuite.c Move generic util functions to shared directory 2014-10-03 00:33:25 -03:00
testsuite.h Move macro.h to shared directory 2014-10-02 22:03:19 -03:00
uname.c testsuite: Fix uname() during glibc startup 2014-03-06 23:09:56 -03:00

README

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. Bare 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 - If you added files to the rootfs, be sure to compact it back to
    rootfs.tar.xz before sending patches: use 'make testsuite-pack-rootfs'

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
    bootstrap-configure instead of simpler bootstrap/autogen.sh