diff mbox series

[v2,4/5] test: Add a flag for tests that need console recording

Message ID 20200729014114.1960556-4-sjg@chromium.org
State Accepted
Commit 132644f56ebb7399fb139d6b9c9e54ef0c218ea9
Delegated to: Tom Rini
Headers show
Series cmd: Fix 'md' and add a memory-search command | expand

Commit Message

Simon Glass July 29, 2020, 1:41 a.m. UTC
Allow tests that need console recording to be marked, so they can be
skipped if it is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 include/test/test.h |  1 +
 test/cmd_ut.c       | 10 ++++++++++
 2 files changed, 11 insertions(+)

Comments

Tom Rini Aug. 8, 2020, 12:30 p.m. UTC | #1
On Tue, Jul 28, 2020 at 07:41:13PM -0600, Simon Glass wrote:

> Allow tests that need console recording to be marked, so they can be
> skipped if it is not available.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/include/test/test.h b/include/test/test.h
index ff92c39006b..67c7d69d488 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -35,6 +35,7 @@  enum {
 	UT_TESTF_SCAN_FDT	= BIT(2),	/* scan device tree */
 	UT_TESTF_FLAT_TREE	= BIT(3),	/* test needs flat DT */
 	UT_TESTF_LIVE_TREE	= BIT(4),	/* needs live device tree */
+	UT_TESTF_CONSOLE_REC	= BIT(5),	/* needs console recording */
 };
 
 /**
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index cc9543c315c..1963f3792cf 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -6,6 +6,7 @@ 
 
 #include <common.h>
 #include <command.h>
+#include <console.h>
 #include <test/suites.h>
 #include <test/test.h>
 
@@ -34,6 +35,15 @@  int cmd_ut_category(const char *name, const char *prefix,
 			continue;
 		printf("Test: %s\n", test->name);
 
+		if (test->flags & UT_TESTF_CONSOLE_REC) {
+			int ret = console_record_reset_enable();
+
+			if (ret) {
+				printf("Skipping: Console recording disabled\n");
+				continue;
+			}
+		}
+
 		uts.start = mallinfo();
 
 		test->func(&uts);