functional testing should not be that darn slow #1076

progress?
This commit is contained in:
rusefi 2019-12-22 01:03:58 -05:00
parent 84ad1e922a
commit b8733edf11
3 changed files with 21 additions and 18 deletions

View File

@ -877,6 +877,7 @@ static void setFuelMap(const char * rpmStr, const char *loadStr, const char *val
config->fuelTable[loadIndex][rpmIndex] = value; config->fuelTable[loadIndex][rpmIndex] = value;
scheduleMsg(&logger, "Setting fuel map entry %d:%d to %.2f", rpmIndex, loadIndex, value); scheduleMsg(&logger, "Setting fuel map entry %d:%d to %.2f", rpmIndex, loadIndex, value);
engine->resetEngineSnifferIfInTestMode();
} }
static void setSpiMode(int index, bool mode) { static void setSpiMode(int index, bool mode) {
@ -1371,6 +1372,7 @@ static void setValue(const char *paramStr, const char *valueStr) {
setDateTime(valueStr); setDateTime(valueStr);
#endif #endif
} }
engine->resetEngineSnifferIfInTestMode();
} }
void initSettings(void) { void initSettings(void) {

View File

@ -101,13 +101,13 @@ public class AutoTest {
String msg = "BMW"; String msg = "BMW";
EngineChart chart; EngineChart chart;
IoUtil.changeRpm(200); IoUtil.changeRpm(200);
chart = nextChart(); chart = nextChart1();
double x = 173.988; double x = 173.988;
// something is wrong here - it's a 6 cylinder here, why 4 cylinder cycle? // 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); assertWave(msg, chart, EngineChart.SPARK_1, 0.0199666, x, x + 180, x + 360, x + 540);
IoUtil.changeRpm(1200); IoUtil.changeRpm(1200);
chart = nextChart(); chart = nextChart1();
x = 688.464; x = 688.464;
// something is wrong here - it's a 6 cylinder here, why 4 cylinder cycle? // something is wrong here - it's a 6 cylinder here, why 4 cylinder cycle?
@ -149,9 +149,8 @@ public class AutoTest {
setEngineType(28); setEngineType(28);
String msg = "mazda 626 default cranking"; String msg = "mazda 626 default cranking";
IoUtil.changeRpm(200); IoUtil.changeRpm(200);
sendCommand(Fields.CMD_TRIGGERINFO);
EngineChart chart; EngineChart chart;
chart = nextChart(); chart = nextChart1();
double x = 102; double x = 102;
assertWave(msg, chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540); 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); assertWave(true, msg, chart, EngineChart.INJECTOR_4, 0.29233, 0.1, 0.2, x);
sendCommand("set_whole_timing_map 520"); sendCommand("set_whole_timing_map 520");
chart = nextChart(); chart = nextChart1();
x = 328; x = 328;
assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540); assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540);
sendCommand("set_whole_timing_map 0"); sendCommand("set_whole_timing_map 0");
chart = nextChart(); chart = nextChart1();
x = 128; x = 128;
assertWave(true, msg, chart, EngineChart.SPARK_1, 0.13299999999999998, EngineReport.RATIO, EngineReport.RATIO, x + 180, x + 540); 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(260);
IoUtil.changeRpm(200); IoUtil.changeRpm(200);
String msg = "ProtegeLX cranking"; String msg = "ProtegeLX cranking";
chart = nextChart(); chart = nextChart1();
assertEquals("", 12, SensorCentral.getInstance().getValue(Sensor.VBATT), 0.1); assertEquals("", 12, SensorCentral.getInstance().getValue(Sensor.VBATT), 0.1);
double x = 107; double x = 107;
assertWave(msg, chart, EngineChart.SPARK_3, 0.194433, x); assertWave(msg, chart, EngineChart.SPARK_3, 0.194433, x);
@ -242,7 +241,7 @@ public class AutoTest {
msg = "ProtegeLX running"; msg = "ProtegeLX running";
IoUtil.changeRpm(2000); IoUtil.changeRpm(2000);
chart = nextChart(); chart = nextChart1();
x = 112; x = 112;
assertWave(msg, chart, EngineChart.SPARK_1, 0.13333333333333333, x, x + 180, x + 360, x + 540); assertWave(msg, chart, EngineChart.SPARK_1, 0.13333333333333333, x, x + 180, x + 360, x + 540);
x = 0; x = 0;
@ -259,7 +258,7 @@ public class AutoTest {
* note that command order matters - RPM change resets wave chart * note that command order matters - RPM change resets wave chart
*/ */
IoUtil.changeRpm(2000); IoUtil.changeRpm(2000);
chart = nextChart(); chart = nextChart1();
String msg = "1995 Neon"; String msg = "1995 Neon";
double x = -70; double x = -70;
@ -279,7 +278,7 @@ public class AutoTest {
sendComplexCommand("set algorithm 3"); sendComplexCommand("set algorithm 3");
IoUtil.changeRpm(2600); IoUtil.changeRpm(2600);
IoUtil.changeRpm(2000); IoUtil.changeRpm(2000);
chart = nextChart(); chart = nextChart1();
x = -70; x = -70;
assertWaveFall(msg, chart, EngineChart.INJECTOR_4, 0.493, x + 540); assertWaveFall(msg, chart, EngineChart.INJECTOR_4, 0.493, x + 540);
} }
@ -292,7 +291,7 @@ public class AutoTest {
setEngineType(4); setEngineType(4);
EngineChart chart; EngineChart chart;
IoUtil.changeRpm(2000); IoUtil.changeRpm(2000);
chart = nextChart(); chart = nextChart1();
String msg = "Fiesta"; String msg = "Fiesta";
double x = 312; double x = 312;
@ -306,7 +305,7 @@ public class AutoTest {
setEngineType(7); setEngineType(7);
EngineChart chart; EngineChart chart;
IoUtil.changeRpm(2000); IoUtil.changeRpm(2000);
chart = nextChart(); chart = nextChart1();
String msg = "ford 6"; 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); 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); assertWaveNull(msg, chart, EngineChart.TRIGGER_2);
sendComplexCommand("set trigger_type 1"); // TT_FORD_ASPIRE sendComplexCommand("set " + "trigger_type" + " 1"); // TT_FORD_ASPIRE
chart = nextChart(); chart = nextChart1();
assertTrue(msg, chart.get(EngineChart.TRIGGER_2) != null); assertTrue(msg, chart.get(EngineChart.TRIGGER_2) != null);
} }
@ -331,14 +330,14 @@ public class AutoTest {
IoUtil.changeRpm(200); IoUtil.changeRpm(200);
double x; double x;
chart = nextChart(); chart = nextChart1();
assertEquals(12, SensorCentral.getInstance().getValue(Sensor.VBATT)); assertEquals(12, SensorCentral.getInstance().getValue(Sensor.VBATT));
x = 55; x = 55;
assertWave("aspire default cranking ", chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540); assertWave("aspire default cranking ", chart, EngineChart.SPARK_1, 0.1944, x, x + 180, x + 360, x + 540);
IoUtil.changeRpm(600); IoUtil.changeRpm(600);
chart = nextChart(); chart = nextChart1();
x = 78; x = 78;
assertWave(true, "aspire default running ", chart, EngineChart.SPARK_1, 0.04, 0.1, 0.1, x, x + 180, x + 360, x + 540); 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"); sendComplexCommand("set algorithm 3");
IoUtil.changeRpm(2400); IoUtil.changeRpm(2400);
IoUtil.changeRpm(2000); IoUtil.changeRpm(2000);
nextChart();
chart = nextChart(); chart = nextChart();
assertEquals("MAP",69.12, SensorCentral.getInstance().getValue(Sensor.MAP)); assertEquals("MAP",69.12, SensorCentral.getInstance().getValue(Sensor.MAP));
//assertEquals(1, SensorCentral.getInstance().getValue(Sensor.)); //assertEquals(1, SensorCentral.getInstance().getValue(Sensor.));

View File

@ -106,6 +106,7 @@ public class TestingUtils {
} }
static EngineChart nextChart() { static EngineChart nextChart() {
long start = System.currentTimeMillis();
/** /**
* we are pretty inefficient here :( we wait for the next chart with new settings already applied * 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 * 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();
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() { static EngineChart nextChart1() {