Robert Marko | 7327b4c | 2022-09-06 13:30:36 +0200 | [diff] [blame] | 1 | // 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 Marko | 7327b4c | 2022-09-06 13:30:36 +0200 | [diff] [blame] | 8 | #include <command.h> |
| 9 | #include <dm.h> |
| 10 | #include <dm/test.h> |
| 11 | #include <test/test.h> |
| 12 | #include <test/ut.h> |
| 13 | |
| 14 | static 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 Marko | 7327b4c | 2022-09-06 13:30:36 +0200 | [diff] [blame] | 21 | /* 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 Glass | 11fcfa3 | 2024-08-22 07:57:50 -0600 | [diff] [blame] | 35 | DM_TEST(dm_test_cmd_temperature, UTF_SCAN_FDT | UTF_CONSOLE); |