Merge pull request #1660 from mck1117/test-crosstalk

reduce crosstalk between tests
This commit is contained in:
rusefillc 2020-07-31 17:49:59 -04:00 committed by GitHub
commit 1c7975723a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 1 deletions

View File

@ -350,11 +350,11 @@ float getMap(void) {
void initMapAveraging(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger;
#if !EFI_UNIT_TEST
#if EFI_SHAFT_POSITION_INPUT
addTriggerEventListener(&mapAveragingTriggerCallback, "MAP averaging", engine);
#endif /* EFI_SHAFT_POSITION_INPUT */
#if !EFI_UNIT_TEST
addConsoleAction("faststat", showMapStats);
#endif /* EFI_UNIT_TEST */

View File

@ -358,7 +358,9 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
return;
}
#if !EFI_UNIT_TEST
addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine);
#endif
addTriggerEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
}

View File

@ -209,5 +209,18 @@ scheduling_s *EventQueue::getElementAtIndexForUnitText(int index) {
}
void EventQueue::clear(void) {
// Flush the queue, resetting all scheduling_s as though we'd executed them
while(head) {
auto x = head;
// link next element to head
head = x->nextScheduling_s;
// Reset this element
x->momentX = 0;
x->isScheduled = false;
x->nextScheduling_s = nullptr;
x->action = {};
}
head = nullptr;
}

View File

@ -10,6 +10,11 @@
bool_t debugSignalExecutor = false;
extern bool verboseMode;
TestExecutor::~TestExecutor() {
// Flush the queue and reset all scheduling_s at the end of a test's execution
clear();
}
void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
if (debugSignalExecutor) {
printf("scheduleTask %d\r\n", delayUs);

View File

@ -12,6 +12,8 @@
class TestExecutor : public ExecutorInterface {
public:
~TestExecutor();
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
void scheduleByTimestampNt(scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;