• Alan Maguire's avatar
    kunit: allow kunit tests to be loaded as a module · c475c77d
    Alan Maguire authored
    As tests are added to kunit, it will become less feasible to execute
    all built tests together.  By supporting modular tests we provide
    a simple way to do selective execution on a running system; specifying
    
    CONFIG_KUNIT=y
    CONFIG_KUNIT_EXAMPLE_TEST=m
    
    ...means we can simply "insmod example-test.ko" to run the tests.
    
    To achieve this we need to do the following:
    
    o export the required symbols in kunit
    o string-stream tests utilize non-exported symbols so for now we skip
      building them when CONFIG_KUNIT_TEST=m.
    o drivers/base/power/qos-test.c contains a few unexported interface
      references, namely freq_qos_read_value() and freq_constraints_init().
      Both of these could be potentially defined as static inline functions
      in include/linux/pm_qos.h, but for now we simply avoid supporting
      module build for that test suite.
    o support a new way of declaring test suites.  Because a module cannot
      do multiple late_initcall()s, we provide a kunit_test_suites() mac...
    c475c77d
Kconfig 4.09 KB