There is already a Python test. Add a few C tests as well, for bootstage itself and for the 'bootstage' command. Add helpers to access the internal state. Be careful to zero records when removing them, since if the record is later reused, bootstage expects the time to be zero. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
33 lines
817 B
C
33 lines
817 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Tests for bootstage command
|
|
*
|
|
* Copyright 2025 Canonical Ltd
|
|
*/
|
|
|
|
#include <bootstage.h>
|
|
#include <test/cmd.h>
|
|
#include <test/ut.h>
|
|
|
|
static int cmd_bootstage_report(struct unit_test_state *uts)
|
|
{
|
|
uint count;
|
|
|
|
/* Get the current record count */
|
|
count = bootstage_get_rec_count();
|
|
ut_assert(count > 0);
|
|
|
|
/* Test the bootstage report command runs successfully */
|
|
ut_assertok(run_command("bootstage report", 0));
|
|
|
|
/* Verify the report contains expected headers and stages */
|
|
ut_assert_nextline("Timer summary in microseconds (%u records):",
|
|
count);
|
|
ut_assert_nextline(" Mark Elapsed Stage");
|
|
ut_assert_nextline(" 0 0 reset");
|
|
ut_assert_skip_to_line("Accumulated time:");
|
|
|
|
return 0;
|
|
}
|
|
CMD_TEST(cmd_bootstage_report, UTF_CONSOLE);
|