aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSteffen Jaeckel <jaeckel-floss@eyet-services.de>2021-07-08 15:57:40 +0200
committerTom Rini <trini@konsulko.com>2021-07-23 13:36:20 -0400
commit25c8b9f298e46ea6048b5308f7ee207c6461c36a (patch)
tree1c8f414dc7ae2d0e914a706e3dd8aaebb945c946 /include
parent33198740aca2d68e9760cfd6ebb5a55894431966 (diff)
downloadu-boot-25c8b9f298e46ea6048b5308f7ee207c6461c36a.zip
u-boot-25c8b9f298e46ea6048b5308f7ee207c6461c36a.tar.gz
u-boot-25c8b9f298e46ea6048b5308f7ee207c6461c36a.tar.bz2
test: add first autoboot unit tests
This adds tests for the crypt-based and plain SHA256-based password hashing algorithms in the autoboot flow. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/console.h17
-rw-r--r--include/test/common.h15
-rw-r--r--include/test/suites.h1
3 files changed, 33 insertions, 0 deletions
diff --git a/include/console.h b/include/console.h
index f848bcb..b182440 100644
--- a/include/console.h
+++ b/include/console.h
@@ -83,6 +83,17 @@ int console_record_readline(char *str, int maxlen);
* @return available bytes (0 if empty)
*/
int console_record_avail(void);
+
+/**
+ * console_in_puts() - Write a string to the console input buffer
+ *
+ * This writes the given string to the console_in buffer which will then be
+ * returned if a function calls e.g. `getc()`
+ *
+ * @str: the string to write
+ * @return the number of bytes added
+ */
+int console_in_puts(const char *str);
#else
static inline int console_record_init(void)
{
@@ -114,6 +125,12 @@ static inline int console_record_avail(void)
return 0;
}
+static inline int console_in_puts(const char *str)
+{
+ /* There is never anything written */
+ return 0;
+}
+
#endif /* !CONFIG_CONSOLE_RECORD */
/**
diff --git a/include/test/common.h b/include/test/common.h
new file mode 100644
index 0000000..81260d0
--- /dev/null
+++ b/include/test/common.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2019 Heinrich Schuchardt <xypron.glpk@gmx.de>
+ * Copyright (c) 2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>
+ */
+
+#ifndef __TEST_COMMON_H__
+#define __TEST_COMMON_H__
+
+#include <test/test.h>
+
+/* Declare a new common function test */
+#define COMMON_TEST(_name, _flags) UNIT_TEST(_name, _flags, common_test)
+
+#endif /* __TEST_COMMON_H__ */
diff --git a/include/test/suites.h b/include/test/suites.h
index 80b41f1..d35cd83 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -31,6 +31,7 @@ int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc,
int do_ut_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
+int do_ut_common(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);