blob: edc751f6e7662b9a0f1b7e585a7e9ae3e81ca53b [file] [log] [blame]
#include <linux/init.h>
#include <linux/moduleparam.h>
#include <linux/printk.h>
#include <linux/reboot.h>
#include <test/test.h>
extern char __test_modules_start;
extern char __test_modules_end;
static int kunit_shutdown;
core_param(kunit_shutdown, kunit_shutdown, int, 0644);
static bool test_run_all_tests(void)
{
struct KUNIT_SUITE_T **module;
struct KUNIT_SUITE_T ** const test_modules_start =
(struct KUNIT_SUITE_T **) &__test_modules_start;
struct KUNIT_SUITE_T ** const test_modules_end =
(struct KUNIT_SUITE_T **) &__test_modules_end;
bool has_test_failed = false;
for (module = test_modules_start; module < test_modules_end; ++module) {
if (test_run_tests(*module))
has_test_failed = true;
}
if (kunit_shutdown)
kernel_halt();
return !has_test_failed;
}
int test_executor_init(void)
{
if (test_run_all_tests())
return 0;
else
return -EFAULT;
}