temperature.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include <common.h>
  8. #include <command.h>
  9. #include <dm.h>
  10. #include <dm/test.h>
  11. #include <test/test.h>
  12. #include <test/ut.h>
  13. static int dm_test_cmd_temperature(struct unit_test_state *uts)
  14. {
  15. struct udevice *dev;
  16. ut_assertok(uclass_get_device(UCLASS_THERMAL, 0, &dev));
  17. ut_assertnonnull(dev);
  18. ut_assertok(console_record_reset_enable());
  19. /* Test that "temperature list" shows the sandbox device */
  20. ut_assertok(run_command("temperature list", 0));
  21. ut_assert_nextline("| Device | Driver | Parent");
  22. ut_assert_nextline("| thermal | thermal-sandbox | root_driver");
  23. ut_assert_console_end();
  24. /* Test that "temperature get thermal" returns expected value */
  25. console_record_reset();
  26. ut_assertok(run_command("temperature get thermal", 0));
  27. ut_assert_nextline("thermal: 100 C");
  28. ut_assert_console_end();
  29. return 0;
  30. }
  31. DM_TEST(dm_test_cmd_temperature, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);