From 0d35b1ebbab9cb6f447dfaafb54683195f6e3f2b Mon Sep 17 00:00:00 2001 From: rusefi Date: Wed, 25 Sep 2019 08:40:33 -0400 Subject: [PATCH] reducing hell in unit tests --- firmware/controllers/actuators/electronic_throttle.cpp | 4 ++++ unit_tests/engine_test_helper.cpp | 2 +- unit_tests/tests/test_idle_controller.cpp | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 3fbcb5ad61..529aca96e1 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -142,6 +142,9 @@ public: // Clamp to >100hz int freq = maxI(100, engineConfiguration->etbFreq); + +// no need to complicate event queue with ETB PWM in unit tests +#if ! EFI_UNIT_TEST startSimplePwm(&m_pwmEnable, "ETB Enable", &engine->executor, &m_pinEnable, @@ -162,6 +165,7 @@ public: freq, 0, (pwm_gen_callback*)applyPinState); +#endif EFI_UNIT_TEST } }; diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index cfdff4f97f..151af11287 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -127,7 +127,7 @@ void EngineTestHelper::fireTriggerEvents2(int count, int durationMs) { void EngineTestHelper::clearQueue() { engine.executor.executeAll(99999999); // this is needed to clear 'isScheduled' flag - ASSERT_EQ( 0, engine.executor.size()) << "queue size/0"; + ASSERT_EQ( 0, engine.executor.size()) << "Failed to clearQueue"; engine.iHead = NULL; // let's drop whatever was scheduled just to start from a clean state } diff --git a/unit_tests/tests/test_idle_controller.cpp b/unit_tests/tests/test_idle_controller.cpp index f7c167d40e..54671528d8 100644 --- a/unit_tests/tests/test_idle_controller.cpp +++ b/unit_tests/tests/test_idle_controller.cpp @@ -107,8 +107,6 @@ TEST(idle, timingPid) { print("******************************************* testTimingPidController\r\n"); WITH_ENGINE_TEST_HELPER(TEST_ENGINE); - // basic engine setup - setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð); // set PID settings pid_s pidS;