test: Add a flag for tests that need console recording
authorSimon Glass <sjg@chromium.org>
Wed, 29 Jul 2020 01:41:13 +0000 (19:41 -0600)
committerTom Rini <trini@konsulko.com>
Sat, 8 Aug 2020 02:31:32 +0000 (22:31 -0400)
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>
include/test/test.h
test/cmd_ut.c

index ff92c39006b6de67773843a491eb32319d532fbc..67c7d69d488e86fd6650881c77c2b1bf4204e63b 100644 (file)
@@ -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 */
 };
 
 /**
index cc9543c315c1eda35a6a64769e18d62cfa197e68..1963f3792cff33187e8eb984f8fc30923c93acb4 100644 (file)
@@ -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);