From b8733edf1177af2c7c9eb66f9e2f9d291cf1a2cd Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 22 Dec 2019 01:03:58 -0500 Subject: [PATCH] functional testing should not be that darn slow #1076 progress? --- firmware/controllers/settings.cpp | 2 ++ .../autotest/src/com/rusefi/AutoTest.java | 32 +++++++++---------- .../autotest/src/com/rusefi/TestingUtils.java | 5 ++- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 7efe06bd1b..065272b2ea 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -877,6 +877,7 @@ static void setFuelMap(const char * rpmStr, const char *loadStr, const char *val config->fuelTable[loadIndex][rpmIndex] = value; scheduleMsg(&logger, "Setting fuel map entry %d:%d to %.2f", rpmIndex, loadIndex, value); + engine->resetEngineSnifferIfInTestMode(); } static void setSpiMode(int index, bool mode) { @@ -1371,6 +1372,7 @@ static void setValue(const char *paramStr, const char *valueStr) { setDateTime(valueStr); #endif } + engine->resetEngineSnifferIfInTestMode(); } void initSettings(void) { diff --git a/java_console/autotest/src/com/rusefi/AutoTest.java b/java_console/autotest/src/com/rusefi/AutoTest.java index b8df5beae8..e3a2c2f159 100644 --- a/java_console/autotest/src/com/rusefi/AutoTest.java +++ b/java_console/autotest/src/com/rusefi/AutoTest.java @@ -101,13 +101,13 @@ public class AutoTest { String msg = "BMW"; EngineChart chart; IoUtil.changeRpm(200); - chart = nextChart(); + chart = nextChart1(); 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); IoUtil.changeRpm(1200); - chart = nextChart(); + chart = nextChart1(); x = 688.464; // something is wrong here - it's a 6 cylinder here, why 4 cylinder cycle? @@ -149,9 +149,8 @@ public class AutoTest { setEngineType(28); String msg = "mazda 626 default cranking"; IoUtil.changeRpm(200); - sendCommand(Fields.CMD_TRIGGERINFO); EngineChart chart; - chart = nextChart(); + chart = nextChart1(); double x = 102; assertWave(msg, chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540); @@ -213,12 +212,12 @@ public class AutoTest { assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.29233, 0.1, 0.2, x); sendCommand("set_whole_timing_map 520"); - chart = nextChart(); + chart = nextChart1(); 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"); - chart = nextChart(); + chart = nextChart1(); x = 128; assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540); } @@ -231,7 +230,7 @@ public class AutoTest { IoUtil.changeRpm(260); IoUtil.changeRpm(200); String msg = "ProtegeLX cranking"; - chart = nextChart(); + chart = nextChart1(); assertEquals("", 12, SensorCentral.getInstance().getValue(Sensor.VBATT), 0.1); double x = 107; assertWave(msg, chart, EngineChart.SPARK_3, 0.194433, x); @@ -242,7 +241,7 @@ public class AutoTest { msg = "ProtegeLX running"; IoUtil.changeRpm(2000); - chart = nextChart(); + chart = nextChart1(); x = 112; assertWave(msg, chart, EngineChart.SPARK_1, 0.13333333333333333, x, x + 180, x + 360, x + 540); x = 0; @@ -259,7 +258,7 @@ public class AutoTest { * note that command order matters - RPM change resets wave chart */ IoUtil.changeRpm(2000); - chart = nextChart(); + chart = nextChart1(); String msg = "1995 Neon"; double x = -70; @@ -279,7 +278,7 @@ public class AutoTest { sendComplexCommand("set algorithm 3"); IoUtil.changeRpm(2600); IoUtil.changeRpm(2000); - chart = nextChart(); + chart = nextChart1(); x = -70; assertWaveFall(msg, chart, EngineChart.INJECTOR_4, 0.493, x + 540); } @@ -292,7 +291,7 @@ public class AutoTest { setEngineType(4); EngineChart chart; IoUtil.changeRpm(2000); - chart = nextChart(); + chart = nextChart1(); String msg = "Fiesta"; double x = 312; @@ -306,7 +305,7 @@ public class AutoTest { setEngineType(7); EngineChart chart; IoUtil.changeRpm(2000); - chart = nextChart(); + chart = nextChart1(); String msg = "ford 6"; @@ -314,8 +313,8 @@ public class AutoTest { assertWave(msg, chart, EngineChart.SPARK_1, 0.01666, x, x + 120, x + 240, x + 360, x + 480, x + 600); assertWaveNull(msg, chart, EngineChart.TRIGGER_2); - sendComplexCommand("set trigger_type 1"); // TT_FORD_ASPIRE - chart = nextChart(); + sendComplexCommand("set " + "trigger_type" + " 1"); // TT_FORD_ASPIRE + chart = nextChart1(); assertTrue(msg, chart.get(EngineChart.TRIGGER_2) != null); } @@ -331,14 +330,14 @@ public class AutoTest { IoUtil.changeRpm(200); double x; - chart = nextChart(); + chart = nextChart1(); 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); IoUtil.changeRpm(600); - chart = nextChart(); + chart = nextChart1(); x = 78; assertWave(true, "aspire default running ", chart, EngineChart.SPARK_1, 0.04, 0.1, 0.1, x, x + 180, x + 360, x + 540); @@ -426,7 +425,6 @@ public class AutoTest { sendComplexCommand("set algorithm 3"); IoUtil.changeRpm(2400); IoUtil.changeRpm(2000); - nextChart(); chart = nextChart(); assertEquals("MAP",69.12, SensorCentral.getInstance().getValue(Sensor.MAP)); //assertEquals(1, SensorCentral.getInstance().getValue(Sensor.)); diff --git a/java_console/autotest/src/com/rusefi/TestingUtils.java b/java_console/autotest/src/com/rusefi/TestingUtils.java index 8b16e50550..bb5c742c03 100644 --- a/java_console/autotest/src/com/rusefi/TestingUtils.java +++ b/java_console/autotest/src/com/rusefi/TestingUtils.java @@ -106,6 +106,7 @@ public class TestingUtils { } static EngineChart nextChart() { + long start = System.currentTimeMillis(); /** * we are pretty inefficient here :( we wait for the next chart with new settings already applied * a potential improvement would be maybe a special test mode which would reset engine sniffer buffer on each @@ -119,7 +120,9 @@ public class TestingUtils { */ getNextWaveChart(); getNextWaveChart(); - return EngineChartParser.unpackToMap(getNextWaveChart()); + EngineChart chart = EngineChartParser.unpackToMap(getNextWaveChart()); + FileLog.MAIN.logLine("AUTOTEST nextChart() in " + (System.currentTimeMillis() - start)); + return chart; } static EngineChart nextChart1() {