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>
This commit is contained in:
committed by
Tom Rini
parent
33198740ac
commit
25c8b9f298
@@ -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 */
|
||||
|
||||
/**
|
||||
|
||||
15
include/test/common.h
Normal file
15
include/test/common.h
Normal file
@@ -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__ */
|
||||
@@ -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[]);
|
||||
|
||||
Reference in New Issue
Block a user