Files
kernel_google_msm-4.14/test/test-test.c
Brendan Higgins 1b54a964ce kunit: test: added the concept of assertions
Added support for assertions which are like expectations except the test
terminates if the assertion is not satisfied.

Change-Id: I7fdcf4d0b602f2a5642ff50d2637e8ddd293ce7c
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
2018-08-14 14:17:23 -07:00

38 lines
756 B
C

// SPDX-License-Identifier: GPL-2.0
/*
* KUnit test for core test infrastructure.
*
* Copyright (C) 2018, Google LLC.
* Author: Brendan Higgins <brendanhiggins@google.com>
*/
#include <test/test.h>
static void test_test_catches_segfault(struct test *test)
{
void (*invalid_func)(void) = (void (*)(void)) SIZE_MAX;
ASSERT_SIGSEGV(test, invalid_func());
}
static int test_test_init(struct test *test)
{
return 0;
}
static void test_test_exit(struct test *test)
{
}
static struct test_case test_test_cases[] = {
TEST_CASE(test_test_catches_segfault),
{},
};
static struct test_module test_test_module = {
.name = "test-test",
.init = test_test_init,
.exit = test_test_exit,
.test_cases = test_test_cases,
};
module_test(test_test_module);