blob: 309693aa1e807cba867afe358cde6ed08dc5bc34 [file] [log] [blame]
Robert Marko7327b4c2022-09-06 13:30:36 +02001// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Executes tests for temperature command
4 *
5 * Copyright (C) 2022 Sartura Ltd.
6 */
7
Robert Marko7327b4c2022-09-06 13:30:36 +02008#include <command.h>
9#include <dm.h>
10#include <dm/test.h>
11#include <test/test.h>
12#include <test/ut.h>
13
14static int dm_test_cmd_temperature(struct unit_test_state *uts)
15{
16 struct udevice *dev;
17
18 ut_assertok(uclass_get_device(UCLASS_THERMAL, 0, &dev));
19 ut_assertnonnull(dev);
20
Robert Marko7327b4c2022-09-06 13:30:36 +020021 /* Test that "temperature list" shows the sandbox device */
22 ut_assertok(run_command("temperature list", 0));
23 ut_assert_nextline("| Device | Driver | Parent");
24 ut_assert_nextline("| thermal | thermal-sandbox | root_driver");
25 ut_assert_console_end();
26
27 /* Test that "temperature get thermal" returns expected value */
28 console_record_reset();
29 ut_assertok(run_command("temperature get thermal", 0));
30 ut_assert_nextline("thermal: 100 C");
31 ut_assert_console_end();
32
33 return 0;
34}
Simon Glass11fcfa32024-08-22 07:57:50 -060035DM_TEST(dm_test_cmd_temperature, UTF_SCAN_FDT | UTF_CONSOLE);