summaryrefstree
path: root/kernel/test/test-death-test.c
blob: 4c347dec766a7b047380753aa638e39293fc2969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: GPL-2.0
/*
 * KUnit test for core test infrastructure.
 *
 * Copyright (C) 2018, Google LLC.
 * Author: Brendan Higgins <brendanhiggins@google.com>
 */
#include <kunit/test.h>

static void test_death_test_catches_segfault(struct test *test)
{
	void (*invalid_func)(void) = (void (*)(void)) SIZE_MAX;

	ASSERT_SIGSEGV(test, invalid_func());
}

static struct test_case test_death_test_cases[] = {
	TEST_CASE(test_death_test_catches_segfault),
	{},
};

static struct test_module test_death_test_module = {
	.name = "test-death-test",
	.test_cases = test_death_test_cases,
};
module_test(test_death_test_module);