*/
long ut_check_delta(ulong last);
+/**
+ * ut_silence_console() - Silence the console if requested by the user
+ *
+ * This stops test output from appear on the console. It is the default on
+ * sandbox, unless the -v flag is given. For other boards, this does nothing.
+ *
+ * @uts: Test state (in case in future we want to keep state here)
+ */
+void ut_silence_console(struct unit_test_state *uts);
+
+/**
+ * ut_unsilence_console() - Unsilence the console after a test
+ *
+ * This restarts console output again and turns off console recording. This
+ * happens on all boards, including sandbox.
+ */
+void ut_unsilence_console(struct unit_test_state *uts);
+
#endif
#include <bloblist.h>
#include <log.h>
#include <mapmem.h>
-#include <asm/state.h>
#include <test/suites.h>
#include <test/test.h>
#include <test/ut.h>
/* Test the 'bloblist info' command */
static int bloblist_test_cmd_info(struct unit_test_state *uts)
{
- struct sandbox_state *state = state_get_current();
struct bloblist_hdr *hdr;
char *data, *data2;
data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2);
console_record_reset_enable();
- if (!state->show_test_output)
- gd->flags |= GD_FLG_SILENT;
+ ut_silence_console(uts);
console_record_reset();
run_command("bloblist info", 0);
ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr));
ut_assert_nextline("alloced: 70 112 Bytes");
ut_assert_nextline("free: 390 912 Bytes");
ut_assert_console_end();
- gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
+ ut_unsilence_console(uts);
return 0;
}
/* Test the 'bloblist list' command */
static int bloblist_test_cmd_list(struct unit_test_state *uts)
{
- struct sandbox_state *state = state_get_current();
struct bloblist_hdr *hdr;
char *data, *data2;
data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2);
console_record_reset_enable();
- if (!state->show_test_output)
- gd->flags |= GD_FLG_SILENT;
+ ut_silence_console(uts);
console_record_reset();
run_command("bloblist list", 0);
ut_assert_nextline("Address Size Tag Name");
ut_assert_nextline("%08lx %8x 2 SPL hand-off",
(ulong)map_to_sysmem(data2), TEST_SIZE2);
ut_assert_console_end();
- gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
+ ut_unsilence_console(uts);
return 0;
}
#include <common.h>
#include <console.h>
#include <malloc.h>
+#ifdef CONFIG_SANDBOX
+#include <asm/state.h>
+#endif
#include <test/test.h>
#include <test/ut.h>
return upto == total_bytes ? 0 : 1;
}
+
+void ut_silence_console(struct unit_test_state *uts)
+{
+#ifdef CONFIG_SANDBOX
+ struct sandbox_state *state = state_get_current();
+
+ if (!state->show_test_output)
+ gd->flags |= GD_FLG_SILENT;
+#endif
+}
+
+void ut_unsilence_console(struct unit_test_state *uts)
+{
+ gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
+}