Add option to slow-down automated tests

The `-w` command-line option takes a delay in millisecond between keystrokes.
Running slower minimizes the chances of a sync issue between the RPL thread and
the test thread. However, this mechanism is still not robust. I need to find a
reliable way to identify when the RPL thread is done processing the input from
the test thread.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
Christophe de Dinechin 2023-06-24 12:31:22 +02:00
parent 503f414ede
commit bb983d1ac5
2 changed files with 15 additions and 8 deletions

View file

@ -38,6 +38,7 @@ RECORDER(options, 32, "Information about command line options");
bool run_tests = false;
bool db48x_keyboard = false;
extern uint wait_time;
int main(int argc, char *argv[])
// ----------------------------------------------------------------------------
@ -67,6 +68,11 @@ int main(int argc, char *argv[])
case 'd':
db48x_keyboard = true;
break;
case 'w':
if (argv[a][2])
wait_time = atoi(argv[a]+2);
else if (a < argc)
wait_time = atoi(argv[++a]);
}
}
}

View file

@ -39,7 +39,8 @@
extern volatile int lcd_needsupdate;
extern char stack0[80];
extern char stack0[80];
extern uint wait_time = 2;
void tests::run(bool onlyCurrent)
// ----------------------------------------------------------------------------
@ -603,7 +604,7 @@ tests &tests::itest(tests::key k, bool release)
// Wait for the RPL thread to process the keys (to be revisited on DM42)
while (!key_remaining())
sys_delay(2);
sys_delay(wait_time);
key_push(k);
if (longpress)
@ -612,12 +613,12 @@ tests &tests::itest(tests::key k, bool release)
longpress = false;
release = false;
}
sys_delay(2);
sys_delay(wait_time);
if (release && k != RELEASE)
{
while (!key_remaining())
sys_delay(2);
sys_delay(wait_time);
key_push(RELEASE);
}
@ -924,8 +925,8 @@ tests &tests::clear()
nokeys();
key_push(CLEAR);
while(!key_empty())
sys_delay(2);
sys_delay(2);
sys_delay(wait_time);
sys_delay(wait_time);
return *this;
}
@ -947,7 +948,7 @@ tests &tests::nokeys()
// ----------------------------------------------------------------------------
{
while (!key_empty())
sys_delay(2);
sys_delay(wait_time);
return *this;
}
@ -958,7 +959,7 @@ tests &tests::refreshed()
// ----------------------------------------------------------------------------
{
while (lcd_needsupdate == lcd_update)
sys_delay(2);
sys_delay(wait_time);
return *this;
}