From 6fae359c07edf808fac16197b349e4c4eecc8ec6 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 12 Dec 2020 18:58:30 -0500 Subject: [PATCH] let's use composition --- .../autotest/src/com/rusefi/AutoTest.java | 184 +++++++++--------- .../src/com/rusefi/EnduranceTestUtility.java | 10 +- .../src/com/rusefi/HardwareTests.java | 26 +-- .../autotest/src/com/rusefi/RealHwTest.java | 9 +- .../autotest/src/com/rusefi/TestingUtils.java | 4 +- .../{BaseTest.java => EcuTestHelper.java} | 28 +-- 6 files changed, 128 insertions(+), 133 deletions(-) rename java_console/autotest/src/com/rusefi/functional_tests/{BaseTest.java => EcuTestHelper.java} (72%) diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index b113270439..b0ac3ef895 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -5,7 +5,7 @@ import com.rusefi.binaryprotocol.BinaryProtocol; import com.rusefi.config.generated.Fields; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.functional_tests.BaseTest; +import com.rusefi.functional_tests.EcuTestHelper; import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; import com.rusefi.waves.EngineChart; @@ -16,7 +16,6 @@ import java.util.function.Function; import static com.rusefi.IoUtil.*; import static com.rusefi.TestingUtils.*; -import static com.rusefi.binaryprotocol.BinaryProtocol.sleep; import static com.rusefi.config.generated.Fields.*; import static com.rusefi.waves.EngineReport.isCloseEnough; @@ -28,12 +27,13 @@ import static com.rusefi.waves.EngineReport.isCloseEnough; * @author Andrey Belomutskiy * 3/5/14 */ -public class AutoTest extends BaseTest { +public class AutoTest { private final LinkManager linkManager; + private final EcuTestHelper ecu; public AutoTest(LinkManager linkManager, CommandQueue commandQueue) { - super(commandQueue); + ecu = new EcuTestHelper(commandQueue); this.linkManager = linkManager; } @@ -42,8 +42,8 @@ public class AutoTest extends BaseTest { // let's make sure 'burn' command works since sometimes it does not bp.burn(); - sendCommand(getDisableCommand(Fields.CMD_TRIGGER_HW_INPUT)); - enableFunctionalMode(); + ecu.sendCommand(getDisableCommand(Fields.CMD_TRIGGER_HW_INPUT)); + ecu.enableFunctionalMode(); testCustomEngine(); testVW_60_2(); testV12(); @@ -70,24 +70,24 @@ public class AutoTest extends BaseTest { }; private void testVW_60_2() { - setEngineType(ET_VW_ABA); + ecu.setEngineType(ET_VW_ABA); // trying to disable engine sniffer to help https://github.com/rusefi/rusefi/issues/1849 - sendCommand("set " + CMD_ENGINESNIFFERRPMTHRESHOLD + " 100"); - changeRpm(900); + ecu.sendCommand("set " + CMD_ENGINESNIFFERRPMTHRESHOLD + " 100"); + ecu.changeRpm(900); // first let's get to expected RPM - assertRpmDoesNotJump(16000, 5, 40, FAIL, commandQueue); + assertRpmDoesNotJump(16000, 5, 40, FAIL, ecu.commandQueue); } private void testV12() { - setEngineType(ET_BMW_M73_F); - changeRpm(700); + ecu.setEngineType(ET_BMW_M73_F); + ecu.changeRpm(700); // first let's get to expected RPM - assertRpmDoesNotJump(16000, 5, 40, FAIL, commandQueue); + assertRpmDoesNotJump(16000, 5, 40, FAIL, ecu.commandQueue); testCaseBug1873(); } private void testCaseBug1873() { - assertRpmDoesNotJump(60, 5, 110, FAIL, commandQueue); + assertRpmDoesNotJump(60, 5, 110, FAIL, ecu.commandQueue); } public static void assertRpmDoesNotJump(int rpm, int settleTime, int testDuration, Function callback, CommandQueue commandQueue) { @@ -109,8 +109,8 @@ public class AutoTest extends BaseTest { } private void testCustomEngine() { - setEngineType(ET_DEFAULT_FRANKENSO); - sendCommand("set_toothed_wheel 4 0"); + ecu.setEngineType(ET_DEFAULT_FRANKENSO); + ecu.sendCommand("set_toothed_wheel 4 0"); // sendCommand("enable trigger_only_front"); // changeRpm(100); // changeRpm(1500); @@ -120,34 +120,34 @@ public class AutoTest extends BaseTest { } private void testMazdaMiata2003() { - setEngineType(ET_FRANKENSO_MIATA_NB2); - sendCommand("get cranking_dwell"); // just test coverage + ecu.setEngineType(ET_FRANKENSO_MIATA_NB2); + ecu.sendCommand("get cranking_dwell"); // just test coverage // sendCommand("get nosuchgettersdfsdfsdfsdf"); // just test coverage } private void testCamaro() { - setEngineType(ET_CAMARO); + ecu.setEngineType(ET_CAMARO); } private void testSachs() { - setEngineType(ET_SACHS); + ecu.setEngineType(ET_SACHS); // String msg = "BMW"; - changeRpm(1200); + ecu.changeRpm(1200); // todo: add more content } private void testBmwE34() { - setEngineType(ET_BMW_E34); - sendCommand("chart 1"); + ecu.setEngineType(ET_BMW_E34); + ecu.sendCommand("chart 1"); String msg = "BMW"; EngineChart chart; - changeRpm(200); + ecu.changeRpm(200); chart = nextChart(); double x = 173.988; // something is wrong here - it's a 6 cylinder here, why 4 cylinder cycle? assertWave(msg, chart, EngineChart.SPARK_1, 0.0199666, x, x + 180, x + 360, x + 540); - changeRpm(1200); + ecu.changeRpm(1200); chart = nextChart(); x = 688.464; @@ -160,29 +160,29 @@ public class AutoTest extends BaseTest { } private void testCitroenBerlingo() { - setEngineType(ET_CITROEN_TU3JP); + ecu.setEngineType(ET_CITROEN_TU3JP); // String msg = "Citroen"; - changeRpm(1200); + ecu.changeRpm(1200); // todo: add more content } private EngineChart nextChart() { - return TestingUtils.nextChart(commandQueue); + return TestingUtils.nextChart(ecu.commandQueue); } private void test2003DodgeNeon() { - setEngineType(ET_DODGE_NEON_2003_CRANK); - sendCommand("set wwaeTau 0"); - sendCommand("set wwaeBeta 0"); - sendCommand("set mock_map_voltage 1"); - sendCommand("set mock_vbatt_voltage 1.20"); - sendCommand("disable cylinder_cleanup"); + ecu.setEngineType(ET_DODGE_NEON_2003_CRANK); + ecu.sendCommand("set wwaeTau 0"); + ecu.sendCommand("set wwaeBeta 0"); + ecu.sendCommand("set mock_map_voltage 1"); + ecu.sendCommand("set mock_vbatt_voltage 1.20"); + ecu.sendCommand("disable cylinder_cleanup"); EngineChart chart; String msg = "2003 Neon cranking "; - changeRpm(200); - changeRpm(250); // another approach to artificial delay - changeRpm(200); - assertEquals("VBatt", 12, SensorCentral.getInstance().getValue(Sensor.VBATT)); + ecu.changeRpm(200); + ecu.changeRpm(250); // another approach to artificial delay + ecu.changeRpm(200); + EcuTestHelper.assertEquals("VBatt", 12, SensorCentral.getInstance().getValue(Sensor.VBATT)); chart = nextChart(); double x = 100; @@ -201,9 +201,9 @@ public class AutoTest extends BaseTest { assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.01056666666666691, 0.02, widthRatio, x, x + 180, x + 360, x + 540); msg = "2003 Neon running"; - changeRpm(2000); - changeRpm(2700); - changeRpm(2000); + ecu.changeRpm(2000); + ecu.changeRpm(2700); + ecu.changeRpm(2000); chart = nextChart(); x = 104.0; assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540); @@ -218,34 +218,34 @@ public class AutoTest extends BaseTest { assertWave(true, msg, chart, EngineChart.INJECTOR_3, 0.29233, 0.15, EngineReport.RATIO, x + 540); assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.29233, 0.15, 0.2, x); - sendCommand(getEnableCommand("trigger_only_front")); + ecu.sendCommand(getEnableCommand("trigger_only_front")); chart = nextChart(); assertWave(true, msg, chart, EngineChart.INJECTOR_1, 0.29233, 0.1, 0.2, x + 360); assertWave(true, msg, chart, EngineChart.INJECTOR_2, 0.29233, EngineReport.RATIO, 0.2, x + 180); assertWave(true, msg, chart, EngineChart.INJECTOR_3, 0.29233, 0.1, 0.2, x + 540); assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.29233, 0.1, 0.2, x); - sendCommand("set_whole_timing_map 520"); + ecu.sendCommand("set_whole_timing_map 520"); chart = nextChart(); x = 328; assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540); - sendCommand("set_whole_timing_map 0"); + ecu.sendCommand("set_whole_timing_map 0"); chart = nextChart(); x = 128; assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540); } private void testMazdaProtege() { - setEngineType(ET_FORD_ESCORT_GT); + ecu.setEngineType(ET_FORD_ESCORT_GT); EngineChart chart; - sendCommand("set mock_vbatt_voltage 1.395"); - changeRpm(200); - changeRpm(260); - changeRpm(200); + ecu.sendCommand("set mock_vbatt_voltage 1.395"); + ecu.changeRpm(200); + ecu.changeRpm(260); + ecu.changeRpm(200); String msg = "ProtegeLX cranking"; chart = nextChart(); - assertEquals("", 12, SensorCentral.getInstance().getValue(Sensor.VBATT), 0.1); + EcuTestHelper.assertEquals("", 12, SensorCentral.getInstance().getValue(Sensor.VBATT), 0.1); double x = 107; assertWave(msg, chart, EngineChart.SPARK_3, 0.194433, x); assertWave(msg, chart, EngineChart.SPARK_1, 0.194433, x + 540); @@ -254,7 +254,7 @@ public class AutoTest extends BaseTest { assertWaveFall(msg, chart, EngineChart.INJECTOR_2, 0.008566666666, x, x + 180, x + 360, x + 540); msg = "ProtegeLX running"; - changeRpm(2000); + ecu.changeRpm(2000); chart = nextChart(); x = 112; assertWave(msg, chart, EngineChart.SPARK_1, 0.13333333333333333, x, x + 180, x + 360, x + 540); @@ -264,14 +264,14 @@ public class AutoTest extends BaseTest { } private void test1995DodgeNeon() { - setEngineType(ET_DODGE_NEON_1995); + ecu.setEngineType(ET_DODGE_NEON_1995); EngineChart chart; sendComplexCommand("set_whole_fuel_map 3"); sendComplexCommand("set_individual_coils_ignition"); /** * note that command order matters - RPM change resets wave chart */ - changeRpm(2000); + ecu.changeRpm(2000); chart = nextChart(); String msg = "1995 Neon"; @@ -288,23 +288,23 @@ public class AutoTest extends BaseTest { assertWave(msg, chart, EngineChart.SPARK_3, 0.13333, x + 360); // switching to Speed Density - sendCommand("set mock_map_voltage 1"); + ecu.sendCommand("set mock_map_voltage 1"); sendComplexCommand("set algorithm 3"); - changeRpm(2600); - changeRpm(2000); + ecu.changeRpm(2600); + ecu.changeRpm(2000); chart = nextChart(); x = -70; assertWaveFall(msg, chart, EngineChart.INJECTOR_4, 0.493, x + 540); } private void testRoverV8() { - setEngineType(ET_ROVER_V8); + ecu.setEngineType(ET_ROVER_V8); } private void testFordFiesta() { - setEngineType(ET_FORD_FIESTA); + ecu.setEngineType(ET_FORD_FIESTA); EngineChart chart; - changeRpm(2000); + ecu.changeRpm(2000); chart = nextChart(); String msg = "Fiesta"; @@ -316,9 +316,9 @@ public class AutoTest extends BaseTest { } private void testFord6() { - setEngineType(ET_FORD_INLINE_6); + ecu.setEngineType(ET_FORD_INLINE_6); EngineChart chart; - changeRpm(2000); + ecu.changeRpm(2000); chart = nextChart(); String msg = "ford 6"; @@ -333,60 +333,60 @@ public class AutoTest extends BaseTest { } private void testFordAspire() { - setEngineType(ET_FORD_ASPIRE); - sendCommand("disable cylinder_cleanup"); - sendCommand("set mock_map_voltage 1"); - sendCommand("set mock_vbatt_voltage 2.2"); + ecu.setEngineType(ET_FORD_ASPIRE); + ecu.sendCommand("disable cylinder_cleanup"); + ecu.sendCommand("set mock_map_voltage 1"); + ecu.sendCommand("set mock_vbatt_voltage 2.2"); String msg; EngineChart chart; // todo: interesting changeRpm(100); sendComplexCommand("set cranking_rpm 500"); - changeRpm(200); + ecu.changeRpm(200); double x; chart = nextChart(); - assertEquals(12, SensorCentral.getInstance().getValue(Sensor.VBATT)); + EcuTestHelper.assertEquals(12, SensorCentral.getInstance().getValue(Sensor.VBATT)); x = 55; assertWave("aspire default cranking ", chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540); - changeRpm(600); + ecu.changeRpm(600); chart = nextChart(); x = 78; assertWave(true, "aspire default running ", chart, EngineChart.SPARK_1, 0.04, 0.1, 0.1, x, x + 180, x + 360, x + 540); - changeRpm(200); + ecu.changeRpm(200); - sendCommand("set cranking_charge_angle 65"); - sendCommand("set cranking_timing_angle -31"); + ecu.sendCommand("set cranking_charge_angle 65"); + ecu.sendCommand("set cranking_timing_angle -31"); chart = nextChart(); x = 55; assertWave("aspire cranking", chart, EngineChart.SPARK_1, 0.18, x, x + 180, x + 360, x + 540); - sendCommand("set cranking_timing_angle -40"); + ecu.sendCommand("set cranking_timing_angle -40"); chart = nextChart(); x = 64; assertWave("aspire", chart, EngineChart.SPARK_1, 0.18, x, x + 180, x + 360, x + 540); - sendCommand("set cranking_timing_angle 149"); + ecu.sendCommand("set cranking_timing_angle 149"); - sendCommand("set cranking_charge_angle 40"); + ecu.sendCommand("set cranking_charge_angle 40"); chart = nextChart(); x = 80; assertWave("aspire", chart, EngineChart.SPARK_1, 40.0 / 360, x, x + 180, x + 360, x + 540); - sendCommand("set cranking_charge_angle 65"); + ecu.sendCommand("set cranking_charge_angle 65"); - changeRpm(600); + ecu.changeRpm(600); sendComplexCommand("set cranking_rpm 700"); chart = nextChart(); x = 55; assertWave("cranking@600", chart, EngineChart.SPARK_1, 0.18, x, x + 180, x + 360, x + 540); - changeRpm(2000); - sendCommand("set_whole_fuel_map 1.57"); + ecu.changeRpm(2000); + ecu.sendCommand("set_whole_fuel_map 1.57"); - changeRpm(2600); - changeRpm(2000); + ecu.changeRpm(2600); + ecu.changeRpm(2000); chart = nextChart(); msg = "aspire running"; @@ -399,12 +399,12 @@ public class AutoTest extends BaseTest { x = 7; assertWave(chart, EngineChart.SPARK_1, 0.133, x, x + 180, x + 360, x + 540); - sendCommand("set_fuel_map 2200 4 15.66"); - sendCommand("set_fuel_map 2000 4 15.66"); - sendCommand("set_fuel_map 2200 4.2 15.66"); - sendCommand("set_fuel_map 2000 4.2 15.66"); + ecu.sendCommand("set_fuel_map 2200 4 15.66"); + ecu.sendCommand("set_fuel_map 2000 4 15.66"); + ecu.sendCommand("set_fuel_map 2200 4.2 15.66"); + ecu.sendCommand("set_fuel_map 2000 4.2 15.66"); // mock 2 means 4 on the gauge because of the divider. should we simplify this? - sendCommand("set " + MOCK_MAF_COMMAND + " 2"); + ecu.sendCommand("set " + MOCK_MAF_COMMAND + " 2"); sendComplexCommand("set global_trigger_offset_angle 175"); chart = nextChart(); @@ -429,18 +429,18 @@ public class AutoTest extends BaseTest { assertWave("Switching Aspire into INDIVIDUAL_COILS mode", chart, EngineChart.SPARK_2, 0.133, x + 540); assertWave(chart, EngineChart.SPARK_3, 0.133, x + 180); - sendCommand("set_whole_timing_map 520"); + ecu.sendCommand("set_whole_timing_map 520"); chart = nextChart(); x = 58.92; assertWave(chart, EngineChart.SPARK_2, 0.133, x); // switching to Speed Density - sendCommand("set mock_maf_voltage 2"); + ecu.sendCommand("set mock_maf_voltage 2"); sendComplexCommand("set algorithm 3"); - changeRpm(2400); - changeRpm(2000); + ecu.changeRpm(2400); + ecu.changeRpm(2000); chart = nextChart(); - assertEquals("MAP", 69.12, SensorCentral.getInstance().getValue(Sensor.MAP)); + EcuTestHelper.assertEquals("MAP", 69.12, SensorCentral.getInstance().getValue(Sensor.MAP)); //assertEquals(1, SensorCentral.getInstance().getValue(Sensor.)); x = 8.88; assertWave(false, msg + " fuel SD #1", chart, EngineChart.INJECTOR_1, 0.577, 0.1, 0.1, x + 180); @@ -449,7 +449,7 @@ public class AutoTest extends BaseTest { assertWave(false, msg + " fuel SD #4", chart, EngineChart.INJECTOR_4, 0.577, 0.1, 0.1, x + 540); // above hard limit - changeRpm(10000); + ecu.changeRpm(10000); chart = nextChart(); assertWaveNull("hard limit check", chart, EngineChart.INJECTOR_1); } @@ -458,7 +458,7 @@ public class AutoTest extends BaseTest { * This method waits for longer then usual. */ private void sendComplexCommand(String command) { - sendCommand(command, COMPLEX_COMMAND_RETRY, Timeouts.CMD_TIMEOUT); + ecu.sendCommand(command, EcuTestHelper.COMPLEX_COMMAND_RETRY, Timeouts.CMD_TIMEOUT); } private static void assertWaveNull(EngineChart chart, String key) { diff --git a/java_console/autotest/src/com/rusefi/EnduranceTestUtility.java b/java_console/autotest/src/com/rusefi/EnduranceTestUtility.java index 0d593e2f3b..48309793ea 100644 --- a/java_console/autotest/src/com/rusefi/EnduranceTestUtility.java +++ b/java_console/autotest/src/com/rusefi/EnduranceTestUtility.java @@ -1,7 +1,7 @@ package com.rusefi; import com.rusefi.config.generated.Fields; -import com.rusefi.functional_tests.BaseTest; +import com.rusefi.functional_tests.EcuTestHelper; import com.rusefi.io.CommandQueue; import com.rusefi.io.LinkManager; @@ -24,13 +24,13 @@ public class EnduranceTestUtility { CommandQueue commandQueue = linkManager.getCommandQueue(); for (int i = 0; i < count; i++) { - BaseTest.currentEngineType = Fields.ET_FORD_ASPIRE; - sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, BaseTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); + EcuTestHelper.currentEngineType = Fields.ET_FORD_ASPIRE; + sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 3, EcuTestHelper.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); sleepSeconds(2); sendCommand(getEnableCommand("self_stimulation"), commandQueue); // IoUtil.changeRpm(1200); - BaseTest.currentEngineType = Fields.ET_DEFAULT_FRANKENSO; - sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, BaseTest.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); + EcuTestHelper.currentEngineType = Fields.ET_DEFAULT_FRANKENSO; + sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + 28, EcuTestHelper.COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT, commandQueue); sleepSeconds(2); FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ " + i + " +++++++++++++++"); } diff --git a/java_console/autotest/src/com/rusefi/HardwareTests.java b/java_console/autotest/src/com/rusefi/HardwareTests.java index 8f951de136..b81ece5865 100644 --- a/java_console/autotest/src/com/rusefi/HardwareTests.java +++ b/java_console/autotest/src/com/rusefi/HardwareTests.java @@ -3,7 +3,7 @@ package com.rusefi; import com.rusefi.config.generated.Fields; import com.rusefi.core.Sensor; import com.rusefi.core.SensorCentral; -import com.rusefi.functional_tests.BaseTest; +import com.rusefi.functional_tests.EcuTestHelper; import com.rusefi.io.CommandQueue; import static com.rusefi.IoUtil.getDisableCommand; @@ -11,10 +11,12 @@ import static com.rusefi.IoUtil.getEnableCommand; import static com.rusefi.binaryprotocol.BinaryProtocol.sleep; import static com.rusefi.config.generated.Fields.*; -public class HardwareTests extends BaseTest { +public class HardwareTests { + + private final EcuTestHelper ecu; public HardwareTests(CommandQueue commandQueue) { - super(commandQueue); + ecu = new EcuTestHelper(commandQueue); } /** @@ -23,24 +25,24 @@ public class HardwareTests extends BaseTest { * PD2<>PA5 */ public void runRealHardwareTests() { - sendCommand(getEnableCommand(Fields.CMD_TRIGGER_HW_INPUT)); - enableFunctionalMode(); + ecu.sendCommand(getEnableCommand(Fields.CMD_TRIGGER_HW_INPUT)); + ecu.enableFunctionalMode(); - setEngineType(ET_FRANKENSO_MIATA_NA6); - sendCommand(getDisableCommand(Fields.CMD_SELF_STIMULATION)); - changeRpm(1400); + ecu.setEngineType(ET_FRANKENSO_MIATA_NA6); + ecu.sendCommand(getDisableCommand(Fields.CMD_SELF_STIMULATION)); + ecu.changeRpm(1400); // moving second trigger to another pin - sendCommand(CMD_TRIGGER_PIN + " 1 PA8"); + ecu.sendCommand(CMD_TRIGGER_PIN + " 1 PA8"); - assertEquals("VSS no input", 0, SensorCentral.getInstance().getValue(Sensor.VSS)); + ecu.assertEquals("VSS no input", 0, SensorCentral.getInstance().getValue(Sensor.VSS)); // attaching VSS to trigger simulator since there is a jumper on test discovery - sendCommand("set " + CMD_VSS_PIN + " pa5"); + ecu.sendCommand("set " + CMD_VSS_PIN + " pa5"); sleep(2 * Timeouts.SECOND); - assertEquals("VSS with input", 3, SensorCentral.getInstance().getValue(Sensor.VSS)); + ecu.assertEquals("VSS with input", 3, SensorCentral.getInstance().getValue(Sensor.VSS)); } } diff --git a/java_console/autotest/src/com/rusefi/RealHwTest.java b/java_console/autotest/src/com/rusefi/RealHwTest.java index 4c9cc18062..09fa18a982 100644 --- a/java_console/autotest/src/com/rusefi/RealHwTest.java +++ b/java_console/autotest/src/com/rusefi/RealHwTest.java @@ -33,7 +33,7 @@ public class RealHwTest { log.info(HW_TESTS_START_UP_SLEEP + " VM option not specified, no start-up sleep in java code"); } - boolean isSuccess = runHardwareTest(args); + boolean isSuccess = runHardwareTest(); if (!isSuccess) System.exit(-1); log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); @@ -42,13 +42,6 @@ public class RealHwTest { System.exit(0); // this is a safer method eliminating the issue of non-daemon threads } - /** - * @return true if test is a SUCCESS, false if a FAILURE - */ - public static boolean runHardwareTest(String[] args) { - return runHardwareTest(); - } - /** * @return true if test is a SUCCESS, false if a FAILURE */ diff --git a/java_console/autotest/src/com/rusefi/TestingUtils.java b/java_console/autotest/src/com/rusefi/TestingUtils.java index 7d6adb5b77..e2e3e92548 100644 --- a/java_console/autotest/src/com/rusefi/TestingUtils.java +++ b/java_console/autotest/src/com/rusefi/TestingUtils.java @@ -3,7 +3,7 @@ package com.rusefi; import com.devexperts.logging.Logging; import com.rusefi.config.generated.Fields; import com.rusefi.core.EngineState; -import com.rusefi.functional_tests.BaseTest; +import com.rusefi.functional_tests.EcuTestHelper; import com.rusefi.io.CommandQueue; import com.rusefi.waves.EngineChart; import com.rusefi.waves.EngineReport; @@ -145,7 +145,7 @@ public class TestingUtils { int timeoutMs = 60 * Timeouts.SECOND; long waitStartTime = System.currentTimeMillis(); IoUtil.wait(engineChartLatch, timeoutMs); - log.info("got next chart in " + (System.currentTimeMillis() - waitStartTime) + "ms for engine_type " + BaseTest.currentEngineType); + log.info("got next chart in " + (System.currentTimeMillis() - waitStartTime) + "ms for engine_type " + EcuTestHelper.currentEngineType); commandQueue.getLinkManager().getEngineState().replaceStringValueAction(EngineReport.ENGINE_CHART, (EngineState.ValueCallback) EngineState.ValueCallback.VOID); if (result.get() == null) throw new IllegalStateException("Chart timeout: " + timeoutMs); diff --git a/java_console/autotest/src/com/rusefi/functional_tests/BaseTest.java b/java_console/autotest/src/com/rusefi/functional_tests/EcuTestHelper.java similarity index 72% rename from java_console/autotest/src/com/rusefi/functional_tests/BaseTest.java rename to java_console/autotest/src/com/rusefi/functional_tests/EcuTestHelper.java index 2169e330aa..5a517c127f 100644 --- a/java_console/autotest/src/com/rusefi/functional_tests/BaseTest.java +++ b/java_console/autotest/src/com/rusefi/functional_tests/EcuTestHelper.java @@ -11,35 +11,35 @@ import static com.devexperts.logging.Logging.getLogging; import static com.rusefi.IoUtil.*; import static com.rusefi.waves.EngineReport.isCloseEnough; -public class BaseTest { - private static final Logging log = getLogging(BaseTest.class); +public class EcuTestHelper { + private static final Logging log = getLogging(EcuTestHelper.class); public static final int COMPLEX_COMMAND_RETRY = 10000; public static int currentEngineType; - protected final CommandQueue commandQueue; + public final CommandQueue commandQueue; - public BaseTest(CommandQueue commandQueue) { + public EcuTestHelper(CommandQueue commandQueue) { this.commandQueue = commandQueue; } - protected static void assertEquals(double expected, double actual) { - BaseTest.assertEquals("", expected, actual); + public static void assertEquals(double expected, double actual) { + EcuTestHelper.assertEquals("", expected, actual); } - protected static void assertEquals(String msg, double expected, double actual) { - BaseTest.assertEquals(msg, expected, actual, EngineReport.RATIO); + public static void assertEquals(String msg, double expected, double actual) { + EcuTestHelper.assertEquals(msg, expected, actual, EngineReport.RATIO); } - protected static void assertEquals(String msg, double expected, double actual, double ratio) { + public static void assertEquals(String msg, double expected, double actual, double ratio) { if (!isCloseEnough(expected, actual, ratio)) throw new IllegalStateException(msg + " Expected " + expected + " but got " + actual); } - protected void sendCommand(String command) { + public void sendCommand(String command) { sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT); } - protected void sendCommand(String command, int retryTimeoutMs, int timeoutMs) { + public void sendCommand(String command, int retryTimeoutMs, int timeoutMs) { TestHelper.INSTANCE.assertNotFatal(); IoUtil.sendCommand(command, retryTimeoutMs, timeoutMs, commandQueue); } @@ -47,15 +47,15 @@ public class BaseTest { /** * this seem to adjust engine sniffer behaviour */ - protected void enableFunctionalMode() { + public void enableFunctionalMode() { sendCommand(getEnableCommand(Fields.CMD_FUNCTIONAL_TEST_MODE)); } - protected void changeRpm(final int rpm) { + public void changeRpm(final int rpm) { IoUtil.changeRpm(commandQueue, rpm); } - protected void setEngineType(int type) { + public void setEngineType(int type) { log.info("AUTOTEST setEngineType " + type); currentEngineType = type; // sendCommand(CMD_PINS);