Applications written using the State-Event Executive can be tested in a scripting or other controlled test environment with the aid of the facilities described in this section.
A special version of various application-defined facilities is used to enable this, as defined in ExecTest.c and TestDep.h. This allows timers and events to be progressed under full control test facility itself, so that testing is not subject to the passage of real time, and so that the state of a system’s internal data can be verified at any point in its sequence of events.
Hence, the test facility implements execAppCurrentTick(), execAppResyncTimer() and the safe CPU idle code. It also provides a means of breaking in and out of the executive’s main loop and re-starting and application after it has been running.
void execTestAdvanceTimer (word TickCount);
Parameters: TickCount time (in ticks) to manually advance time by
This function advances the system timer by the specified increment, causing the posting of events (in sequence) of any timers that time out during that time increment.
Note that the timer in the test environment is not tied to any real timer, and the only way to progress simulated time is via this function.
word execWinQuit (word Events);
Parameters: Events the maximum number of events to process
Returns: the number of events actually processed.
Call this function to run the main loop of the executive as many times as is required to either process all the events in the event queues, or to process the number of events specified, if this number is less than the number of events pending.
Calling this function does not perform any initialisation (execAppInit()).execTestStart() should be called prior to any number of calls to this function.
Call this function with a value of 0xffff to process all outstanding events.
void execTestStart (void);
This function initialises the executive’s own internal data structures and calls the application initialisation function (execAppInit()).
It cannot initialise any of the application’s global (or other static) data. Therefore, if this function is being called subsequent to exercising part of the system, then the test environment must also re-initialise the application’s data.