mirror of
https://github.com/c3d/DB48X-on-DM42.git
synced 2024-09-28 03:20:53 +02:00
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:
parent
503f414ede
commit
bb983d1ac5
2 changed files with 15 additions and 8 deletions
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
17
src/tests.cc
17
src/tests.cc
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue