mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
sandbox: Add a way to skip time delays
Some tests are slow due to delays which are unnecessary on sandbox. The worst offender is USB where we lose two seconds. Add a way to disable time delays. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@ -37,7 +37,10 @@ void sandbox_exit(void)
|
|||||||
/* delay x useconds */
|
/* delay x useconds */
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
{
|
{
|
||||||
os_usleep(usec);
|
struct sandbox_state *state = state_get_current();
|
||||||
|
|
||||||
|
if (!state->skip_delays)
|
||||||
|
os_usleep(usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cleanup_before_linux(void)
|
int cleanup_before_linux(void)
|
||||||
|
@ -337,6 +337,20 @@ struct sandbox_state *state_get_current(void)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void state_set_skip_delays(bool skip_delays)
|
||||||
|
{
|
||||||
|
struct sandbox_state *state = state_get_current();
|
||||||
|
|
||||||
|
state->skip_delays = skip_delays;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool state_get_skip_delays(void)
|
||||||
|
{
|
||||||
|
struct sandbox_state *state = state_get_current();
|
||||||
|
|
||||||
|
return state->skip_delays;
|
||||||
|
}
|
||||||
|
|
||||||
int state_init(void)
|
int state_init(void)
|
||||||
{
|
{
|
||||||
state = &main_state;
|
state = &main_state;
|
||||||
|
@ -63,6 +63,7 @@ struct sandbox_state {
|
|||||||
enum reset_t last_reset; /* Last reset type */
|
enum reset_t last_reset; /* Last reset type */
|
||||||
bool reset_allowed[RESET_COUNT]; /* Allowed reset types */
|
bool reset_allowed[RESET_COUNT]; /* Allowed reset types */
|
||||||
enum state_terminal_raw term_raw; /* Terminal raw/cooked */
|
enum state_terminal_raw term_raw; /* Terminal raw/cooked */
|
||||||
|
bool skip_delays; /* Ignore any time delays (for test) */
|
||||||
|
|
||||||
/* Pointer to information for each SPI bus/cs */
|
/* Pointer to information for each SPI bus/cs */
|
||||||
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
|
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
|
||||||
@ -184,6 +185,24 @@ int sandbox_write_state(struct sandbox_state *state, const char *fname);
|
|||||||
*/
|
*/
|
||||||
int state_setprop(int node, const char *prop_name, const void *data, int size);
|
int state_setprop(int node, const char *prop_name, const void *data, int size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Control skipping of time delays
|
||||||
|
*
|
||||||
|
* Some tests have unnecessay time delays (e.g. USB). Allow these to be
|
||||||
|
* skipped to speed up testing
|
||||||
|
*
|
||||||
|
* @param skip_delays true to skip delays from now on, false to honour delay
|
||||||
|
* requests
|
||||||
|
*/
|
||||||
|
void state_set_skip_delays(bool skip_delays);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See if delays should be skipped
|
||||||
|
*
|
||||||
|
* @return true if delays should be skipped, false if they should be honoured
|
||||||
|
*/
|
||||||
|
bool state_get_skip_delays(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the test system state
|
* Initialize the test system state
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user