summaryrefslogtreecommitdiff
path: root/test/chipset.c
blob: 6c9031e3f07b44fff04b6764ec75510a7acf0786 (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
27
28
29
30
31
32
/* Copyright 2022 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * Test chipset
 */

#define CONFIG_CMD_AP_RESET_LOG

#include "chipset.h"
#include "test_util.h"

static int test_get_shutdown_reason(void)
{
	enum chipset_shutdown_reason reason = chipset_get_shutdown_reason();

	TEST_ASSERT(reason == 0);
	report_ap_reset(CHIPSET_SHUTDOWN_POWERFAIL);
	reason = chipset_get_shutdown_reason();
	TEST_ASSERT(reason == CHIPSET_SHUTDOWN_POWERFAIL);

	return EC_SUCCESS;
}

void run_test(int argc, const char **argv)
{
	test_reset();

	RUN_TEST(test_get_shutdown_reason);

	test_print_result();
}