Merge branch '2020-05-08-assorted-fixes'
This commit is contained in:
		
						commit
						c5c657644b
					
				| 
						 | 
					@ -223,7 +223,7 @@ static int ahci_host_init(struct ahci_uc_priv *uc_priv)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Wait for COMINIT bit 26 (DIAG_X) in SERR */
 | 
							/* Wait for COMINIT bit 26 (DIAG_X) in SERR */
 | 
				
			||||||
		timeout = 1000;
 | 
							timeout = 1000;
 | 
				
			||||||
		while (!(readl(&port_mmio->serr) | SATA_PORT_SERR_DIAG_X)
 | 
							while (!(readl(&port_mmio->serr) & SATA_PORT_SERR_DIAG_X)
 | 
				
			||||||
			&& --timeout)
 | 
								&& --timeout)
 | 
				
			||||||
			;
 | 
								;
 | 
				
			||||||
		if (timeout <= 0) {
 | 
							if (timeout <= 0) {
 | 
				
			||||||
| 
						 | 
					@ -450,7 +450,6 @@ static int ahci_port_start(struct ahci_uc_priv *uc_priv, u8 port)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mem = (u32)malloc(AHCI_PORT_PRIV_DMA_SZ + 1024);
 | 
						mem = (u32)malloc(AHCI_PORT_PRIV_DMA_SZ + 1024);
 | 
				
			||||||
	if (!mem) {
 | 
						if (!mem) {
 | 
				
			||||||
		free(pp);
 | 
					 | 
				
			||||||
		printf("No mem for table!\n");
 | 
							printf("No mem for table!\n");
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -847,6 +846,9 @@ static int ahci_init_one(int pdev)
 | 
				
			||||||
	struct ahci_uc_priv *uc_priv = NULL;
 | 
						struct ahci_uc_priv *uc_priv = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uc_priv = malloc(sizeof(struct ahci_uc_priv));
 | 
						uc_priv = malloc(sizeof(struct ahci_uc_priv));
 | 
				
			||||||
 | 
						if (!uc_priv)
 | 
				
			||||||
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memset(uc_priv, 0, sizeof(struct ahci_uc_priv));
 | 
						memset(uc_priv, 0, sizeof(struct ahci_uc_priv));
 | 
				
			||||||
	uc_priv->dev = pdev;
 | 
						uc_priv->dev = pdev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -871,6 +873,8 @@ static int ahci_init_one(int pdev)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_out:
 | 
					err_out:
 | 
				
			||||||
 | 
						if (uc_priv)
 | 
				
			||||||
 | 
							free(uc_priv);
 | 
				
			||||||
	return rc;
 | 
						return rc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -914,6 +918,9 @@ int reset_sata(int dev)
 | 
				
			||||||
	while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
 | 
						while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
 | 
				
			||||||
		udelay(100);
 | 
							udelay(100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(uc_priv);
 | 
				
			||||||
 | 
						memset(&sata_dev_desc[dev], 0, sizeof(struct blk_desc));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -305,7 +305,7 @@ U_BOOT_ENV_LOCATION(sf) = {
 | 
				
			||||||
	.location	= ENVL_SPI_FLASH,
 | 
						.location	= ENVL_SPI_FLASH,
 | 
				
			||||||
	ENV_NAME("SPI Flash")
 | 
						ENV_NAME("SPI Flash")
 | 
				
			||||||
	.load		= env_sf_load,
 | 
						.load		= env_sf_load,
 | 
				
			||||||
	.save		= ENV_SAVE_PTR(env_sf_save),
 | 
						.save		= CONFIG_IS_ENABLED(SAVEENV) ? ENV_SAVE_PTR(env_sf_save) : NULL,
 | 
				
			||||||
#if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
 | 
					#if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0)
 | 
				
			||||||
	.init		= env_sf_init,
 | 
						.init		= env_sf_init,
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,29 @@ struct unit_test {
 | 
				
			||||||
	int flags;
 | 
						int flags;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Declare a new unit test */
 | 
					/**
 | 
				
			||||||
 | 
					 * UNIT_TEST() - create linker generated list entry for unit a unit test
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The macro UNIT_TEST() is used to create a linker generated list entry. These
 | 
				
			||||||
 | 
					 * list entries are enumerate tests that can be execute using the ut command.
 | 
				
			||||||
 | 
					 * The list entries are used both by the implementation of the ut command as
 | 
				
			||||||
 | 
					 * well as in a related Python test.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * For Python testing the subtests are collected in Python function
 | 
				
			||||||
 | 
					 * generate_ut_subtest() by applying a regular expression to the lines of file
 | 
				
			||||||
 | 
					 * u-boot.sym. The list entries have to follow strict naming conventions to be
 | 
				
			||||||
 | 
					 * matched by the expression.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Use UNIT_TEST(foo_test_bar, _flags, foo_test) for a test bar in test suite
 | 
				
			||||||
 | 
					 * foo that can be executed via command 'ut foo bar' and is implemented in
 | 
				
			||||||
 | 
					 * function foo_test_bar().
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @_name:	concatenation of name of the test suite, "_test_", and the name
 | 
				
			||||||
 | 
					 *		of the test
 | 
				
			||||||
 | 
					 * @_flags:	an integer field that can be evaluated by the test suite
 | 
				
			||||||
 | 
					 *		implementation
 | 
				
			||||||
 | 
					 * @_suite:	name of the test suite concatenated with "_test"
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
#define UNIT_TEST(_name, _flags, _suite)				\
 | 
					#define UNIT_TEST(_name, _flags, _suite)				\
 | 
				
			||||||
	ll_entry_declare(struct unit_test, _name, _suite) = {		\
 | 
						ll_entry_declare(struct unit_test, _name, _suite) = {		\
 | 
				
			||||||
		.file = __FILE__,					\
 | 
							.file = __FILE__,					\
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BUFFSIZE 32
 | 
					#define BUFFSIZE 32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nolog_test_log_err(struct unit_test_state *uts)
 | 
					static int log_test_nolog_err(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[BUFFSIZE];
 | 
						char buf[BUFFSIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,9 +31,9 @@ static int nolog_test_log_err(struct unit_test_state *uts)
 | 
				
			||||||
	ut_assertok(ut_check_console_end(uts));
 | 
						ut_assertok(ut_check_console_end(uts));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_log_err);
 | 
					LOG_TEST(log_test_nolog_err);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nolog_test_log_warning(struct unit_test_state *uts)
 | 
					static int log_test_nolog_warning(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[BUFFSIZE];
 | 
						char buf[BUFFSIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,9 +45,9 @@ static int nolog_test_log_warning(struct unit_test_state *uts)
 | 
				
			||||||
	ut_assertok(ut_check_console_end(uts));
 | 
						ut_assertok(ut_check_console_end(uts));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_log_warning);
 | 
					LOG_TEST(log_test_nolog_warning);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nolog_test_log_notice(struct unit_test_state *uts)
 | 
					static int log_test_nolog_notice(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[BUFFSIZE];
 | 
						char buf[BUFFSIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,9 +59,9 @@ static int nolog_test_log_notice(struct unit_test_state *uts)
 | 
				
			||||||
	ut_assertok(ut_check_console_end(uts));
 | 
						ut_assertok(ut_check_console_end(uts));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_log_notice);
 | 
					LOG_TEST(log_test_nolog_notice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nolog_test_log_info(struct unit_test_state *uts)
 | 
					static int log_test_nolog_info(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[BUFFSIZE];
 | 
						char buf[BUFFSIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ static int nolog_test_log_info(struct unit_test_state *uts)
 | 
				
			||||||
	ut_assertok(ut_check_console_end(uts));
 | 
						ut_assertok(ut_check_console_end(uts));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_log_info);
 | 
					LOG_TEST(log_test_nolog_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef _DEBUG
 | 
					#undef _DEBUG
 | 
				
			||||||
#define _DEBUG 0
 | 
					#define _DEBUG 0
 | 
				
			||||||
| 
						 | 
					@ -90,7 +90,7 @@ static int nolog_test_nodebug(struct unit_test_state *uts)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_nodebug);
 | 
					LOG_TEST(nolog_test_nodebug);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nolog_test_log_nodebug(struct unit_test_state *uts)
 | 
					static int log_test_nolog_nodebug(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[BUFFSIZE];
 | 
						char buf[BUFFSIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ static int nolog_test_log_nodebug(struct unit_test_state *uts)
 | 
				
			||||||
	ut_assertok(ut_check_console_end(uts));
 | 
						ut_assertok(ut_check_console_end(uts));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_log_nodebug);
 | 
					LOG_TEST(log_test_nolog_nodebug);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef _DEBUG
 | 
					#undef _DEBUG
 | 
				
			||||||
#define _DEBUG 1
 | 
					#define _DEBUG 1
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ static int nolog_test_debug(struct unit_test_state *uts)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_debug);
 | 
					LOG_TEST(nolog_test_debug);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int nolog_test_log_debug(struct unit_test_state *uts)
 | 
					static int log_test_nolog_debug(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char buf[BUFFSIZE];
 | 
						char buf[BUFFSIZE];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,4 +132,4 @@ static int nolog_test_log_debug(struct unit_test_state *uts)
 | 
				
			||||||
	ut_assertok(ut_check_console_end(uts));
 | 
						ut_assertok(ut_check_console_end(uts));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(nolog_test_log_debug);
 | 
					LOG_TEST(log_test_nolog_debug);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,12 +92,12 @@ static int sb_log_tx_handler(struct udevice *dev, void *packet,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * syslog_test_log_err() - test log_err() function
 | 
					 * log_test_syslog_err() - test log_err() function
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @uts:	unit test state
 | 
					 * @uts:	unit test state
 | 
				
			||||||
 * Return:	0 = success
 | 
					 * Return:	0 = success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int syslog_test_log_err(struct unit_test_state *uts)
 | 
					static int log_test_syslog_err(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_log_level = gd->default_log_level;
 | 
						int old_log_level = gd->default_log_level;
 | 
				
			||||||
	struct sb_log_env env;
 | 
						struct sb_log_env env;
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,7 @@ static int syslog_test_log_err(struct unit_test_state *uts)
 | 
				
			||||||
	gd->default_log_level = LOGL_INFO;
 | 
						gd->default_log_level = LOGL_INFO;
 | 
				
			||||||
	env_set("ethact", "eth@10002000");
 | 
						env_set("ethact", "eth@10002000");
 | 
				
			||||||
	env_set("log_hostname", "sandbox");
 | 
						env_set("log_hostname", "sandbox");
 | 
				
			||||||
	env.expected = "<3>sandbox uboot: syslog_test_log_err() "
 | 
						env.expected = "<3>sandbox uboot: log_test_syslog_err() "
 | 
				
			||||||
		       "testing log_err\n";
 | 
							       "testing log_err\n";
 | 
				
			||||||
	env.uts = uts;
 | 
						env.uts = uts;
 | 
				
			||||||
	sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
						sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
				
			||||||
| 
						 | 
					@ -119,15 +119,15 @@ static int syslog_test_log_err(struct unit_test_state *uts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(syslog_test_log_err);
 | 
					LOG_TEST(log_test_syslog_err);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * syslog_test_log_warning() - test log_warning() function
 | 
					 * log_test_syslog_warning() - test log_warning() function
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @uts:	unit test state
 | 
					 * @uts:	unit test state
 | 
				
			||||||
 * Return:	0 = success
 | 
					 * Return:	0 = success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int syslog_test_log_warning(struct unit_test_state *uts)
 | 
					static int log_test_syslog_warning(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_log_level = gd->default_log_level;
 | 
						int old_log_level = gd->default_log_level;
 | 
				
			||||||
	struct sb_log_env env;
 | 
						struct sb_log_env env;
 | 
				
			||||||
| 
						 | 
					@ -136,7 +136,7 @@ static int syslog_test_log_warning(struct unit_test_state *uts)
 | 
				
			||||||
	gd->default_log_level = LOGL_INFO;
 | 
						gd->default_log_level = LOGL_INFO;
 | 
				
			||||||
	env_set("ethact", "eth@10002000");
 | 
						env_set("ethact", "eth@10002000");
 | 
				
			||||||
	env_set("log_hostname", "sandbox");
 | 
						env_set("log_hostname", "sandbox");
 | 
				
			||||||
	env.expected = "<4>sandbox uboot: syslog_test_log_warning() "
 | 
						env.expected = "<4>sandbox uboot: log_test_syslog_warning() "
 | 
				
			||||||
		       "testing log_warning\n";
 | 
							       "testing log_warning\n";
 | 
				
			||||||
	env.uts = uts;
 | 
						env.uts = uts;
 | 
				
			||||||
	sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
						sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
				
			||||||
| 
						 | 
					@ -150,15 +150,15 @@ static int syslog_test_log_warning(struct unit_test_state *uts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(syslog_test_log_warning);
 | 
					LOG_TEST(log_test_syslog_warning);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * syslog_test_log_notice() - test log_notice() function
 | 
					 * log_test_syslog_notice() - test log_notice() function
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @uts:	unit test state
 | 
					 * @uts:	unit test state
 | 
				
			||||||
 * Return:	0 = success
 | 
					 * Return:	0 = success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int syslog_test_log_notice(struct unit_test_state *uts)
 | 
					static int log_test_syslog_notice(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_log_level = gd->default_log_level;
 | 
						int old_log_level = gd->default_log_level;
 | 
				
			||||||
	struct sb_log_env env;
 | 
						struct sb_log_env env;
 | 
				
			||||||
| 
						 | 
					@ -167,7 +167,7 @@ static int syslog_test_log_notice(struct unit_test_state *uts)
 | 
				
			||||||
	gd->default_log_level = LOGL_INFO;
 | 
						gd->default_log_level = LOGL_INFO;
 | 
				
			||||||
	env_set("ethact", "eth@10002000");
 | 
						env_set("ethact", "eth@10002000");
 | 
				
			||||||
	env_set("log_hostname", "sandbox");
 | 
						env_set("log_hostname", "sandbox");
 | 
				
			||||||
	env.expected = "<5>sandbox uboot: syslog_test_log_notice() "
 | 
						env.expected = "<5>sandbox uboot: log_test_syslog_notice() "
 | 
				
			||||||
		       "testing log_notice\n";
 | 
							       "testing log_notice\n";
 | 
				
			||||||
	env.uts = uts;
 | 
						env.uts = uts;
 | 
				
			||||||
	sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
						sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
				
			||||||
| 
						 | 
					@ -181,15 +181,15 @@ static int syslog_test_log_notice(struct unit_test_state *uts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(syslog_test_log_notice);
 | 
					LOG_TEST(log_test_syslog_notice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * syslog_test_log_info() - test log_info() function
 | 
					 * log_test_syslog_info() - test log_info() function
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @uts:	unit test state
 | 
					 * @uts:	unit test state
 | 
				
			||||||
 * Return:	0 = success
 | 
					 * Return:	0 = success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int syslog_test_log_info(struct unit_test_state *uts)
 | 
					static int log_test_syslog_info(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_log_level = gd->default_log_level;
 | 
						int old_log_level = gd->default_log_level;
 | 
				
			||||||
	struct sb_log_env env;
 | 
						struct sb_log_env env;
 | 
				
			||||||
| 
						 | 
					@ -198,7 +198,7 @@ static int syslog_test_log_info(struct unit_test_state *uts)
 | 
				
			||||||
	gd->default_log_level = LOGL_INFO;
 | 
						gd->default_log_level = LOGL_INFO;
 | 
				
			||||||
	env_set("ethact", "eth@10002000");
 | 
						env_set("ethact", "eth@10002000");
 | 
				
			||||||
	env_set("log_hostname", "sandbox");
 | 
						env_set("log_hostname", "sandbox");
 | 
				
			||||||
	env.expected = "<6>sandbox uboot: syslog_test_log_info() "
 | 
						env.expected = "<6>sandbox uboot: log_test_syslog_info() "
 | 
				
			||||||
		       "testing log_info\n";
 | 
							       "testing log_info\n";
 | 
				
			||||||
	env.uts = uts;
 | 
						env.uts = uts;
 | 
				
			||||||
	sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
						sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
				
			||||||
| 
						 | 
					@ -212,15 +212,15 @@ static int syslog_test_log_info(struct unit_test_state *uts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(syslog_test_log_info);
 | 
					LOG_TEST(log_test_syslog_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * syslog_test_log_debug() - test log_debug() function
 | 
					 * log_test_syslog_debug() - test log_debug() function
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @uts:	unit test state
 | 
					 * @uts:	unit test state
 | 
				
			||||||
 * Return:	0 = success
 | 
					 * Return:	0 = success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int syslog_test_log_debug(struct unit_test_state *uts)
 | 
					static int log_test_syslog_debug(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_log_level = gd->default_log_level;
 | 
						int old_log_level = gd->default_log_level;
 | 
				
			||||||
	struct sb_log_env env;
 | 
						struct sb_log_env env;
 | 
				
			||||||
| 
						 | 
					@ -229,7 +229,7 @@ static int syslog_test_log_debug(struct unit_test_state *uts)
 | 
				
			||||||
	gd->default_log_level = LOGL_DEBUG;
 | 
						gd->default_log_level = LOGL_DEBUG;
 | 
				
			||||||
	env_set("ethact", "eth@10002000");
 | 
						env_set("ethact", "eth@10002000");
 | 
				
			||||||
	env_set("log_hostname", "sandbox");
 | 
						env_set("log_hostname", "sandbox");
 | 
				
			||||||
	env.expected = "<7>sandbox uboot: syslog_test_log_debug() "
 | 
						env.expected = "<7>sandbox uboot: log_test_syslog_debug() "
 | 
				
			||||||
		       "testing log_debug\n";
 | 
							       "testing log_debug\n";
 | 
				
			||||||
	env.uts = uts;
 | 
						env.uts = uts;
 | 
				
			||||||
	sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
						sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
				
			||||||
| 
						 | 
					@ -243,10 +243,10 @@ static int syslog_test_log_debug(struct unit_test_state *uts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(syslog_test_log_debug);
 | 
					LOG_TEST(log_test_syslog_debug);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * syslog_test_log_nodebug() - test logging level filter
 | 
					 * log_test_syslog_nodebug() - test logging level filter
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Verify that log_debug() does not lead to a log message if the logging level
 | 
					 * Verify that log_debug() does not lead to a log message if the logging level
 | 
				
			||||||
 * is set to LOGL_INFO.
 | 
					 * is set to LOGL_INFO.
 | 
				
			||||||
| 
						 | 
					@ -254,7 +254,7 @@ LOG_TEST(syslog_test_log_debug);
 | 
				
			||||||
 * @uts:	unit test state
 | 
					 * @uts:	unit test state
 | 
				
			||||||
 * Return:	0 = success
 | 
					 * Return:	0 = success
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static int syslog_test_log_nodebug(struct unit_test_state *uts)
 | 
					static int log_test_syslog_nodebug(struct unit_test_state *uts)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int old_log_level = gd->default_log_level;
 | 
						int old_log_level = gd->default_log_level;
 | 
				
			||||||
	struct sb_log_env env;
 | 
						struct sb_log_env env;
 | 
				
			||||||
| 
						 | 
					@ -263,7 +263,7 @@ static int syslog_test_log_nodebug(struct unit_test_state *uts)
 | 
				
			||||||
	gd->default_log_level = LOGL_INFO;
 | 
						gd->default_log_level = LOGL_INFO;
 | 
				
			||||||
	env_set("ethact", "eth@10002000");
 | 
						env_set("ethact", "eth@10002000");
 | 
				
			||||||
	env_set("log_hostname", "sandbox");
 | 
						env_set("log_hostname", "sandbox");
 | 
				
			||||||
	env.expected = "<7>sandbox uboot: syslog_test_log_nodebug() "
 | 
						env.expected = "<7>sandbox uboot: log_test_syslog_nodebug() "
 | 
				
			||||||
		       "testing log_debug\n";
 | 
							       "testing log_debug\n";
 | 
				
			||||||
	env.uts = uts;
 | 
						env.uts = uts;
 | 
				
			||||||
	sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
						sandbox_eth_set_tx_handler(0, sb_log_tx_handler);
 | 
				
			||||||
| 
						 | 
					@ -277,4 +277,4 @@ static int syslog_test_log_nodebug(struct unit_test_state *uts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
LOG_TEST(syslog_test_log_nodebug);
 | 
					LOG_TEST(log_test_syslog_nodebug);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,22 @@ def test_ut_dm_init(u_boot_console):
 | 
				
			||||||
            fh.write(data)
 | 
					            fh.write(data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_ut(u_boot_console, ut_subtest):
 | 
					def test_ut(u_boot_console, ut_subtest):
 | 
				
			||||||
    """Execute a "ut" subtest."""
 | 
					    """Execute a "ut" subtest.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    The subtests are collected in function generate_ut_subtest() from linker
 | 
				
			||||||
 | 
					    generated lists by applying a regular expression to the lines of file
 | 
				
			||||||
 | 
					    u-boot.sym. The list entries are created using the C macro UNIT_TEST().
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Strict naming conventions have to be followed to match the regular
 | 
				
			||||||
 | 
					    expression. Use UNIT_TEST(foo_test_bar, _flags, foo_test) for a test bar in
 | 
				
			||||||
 | 
					    test suite foo that can be executed via command 'ut foo bar' and is
 | 
				
			||||||
 | 
					    implemented in C function foo_test_bar().
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Args:
 | 
				
			||||||
 | 
					        u_boot_console (ConsoleBase): U-Boot console
 | 
				
			||||||
 | 
					        ut_subtest (str): test to be executed via command ut, e.g 'foo bar' to
 | 
				
			||||||
 | 
					            execute command 'ut foo bar'
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    output = u_boot_console.run_command('ut ' + ut_subtest)
 | 
					    output = u_boot_console.run_command('ut ' + ut_subtest)
 | 
				
			||||||
    assert output.endswith('Failures: 0')
 | 
					    assert output.endswith('Failures: 0')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue