summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/default/src/system.c
blob: e3d2aeb5ac77ac2a298a02d50f05ad2a6a206ae5 (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
/* 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.
 */

#include <zephyr/zephyr.h>
#include <zephyr/ztest.h>

#include "ec_commands.h"
#include "host_command.h"
#include "test/drivers/test_state.h"

ZTEST_USER(system, test_hostcmd_sysinfo)
{
	struct ec_response_sysinfo response;
	struct host_cmd_handler_args args =
		BUILD_HOST_COMMAND_RESPONSE(EC_CMD_SYSINFO, 0, response);

	/* Simply issue the command and get the results */
	zassert_ok(host_command_process(&args), NULL);
	zassert_ok(args.result, NULL);
	zassert_equal(args.response_size, sizeof(response), NULL);
	zassert_equal(response.reset_flags, 0, "response.reset_flags = %d",
		      response.reset_flags);
	zassert_equal(response.current_image, EC_IMAGE_RO,
		      "response.current_image = %d", response.current_image);
	zassert_equal(response.flags, 0, "response.flags = %d", response.flags);
}

ZTEST_SUITE(system, drivers_predicate_post_main, NULL, NULL, NULL, NULL);