hardware continues integration needs a high RPM high tooth count test case
#1351
This commit is contained in:
parent
1051b6435c
commit
59b3c1c92c
|
@ -9,13 +9,11 @@ import com.rusefi.core.MessagesCentral;
|
||||||
import com.rusefi.core.Sensor;
|
import com.rusefi.core.Sensor;
|
||||||
import com.rusefi.core.SensorCentral;
|
import com.rusefi.core.SensorCentral;
|
||||||
import com.rusefi.io.CommandQueue;
|
import com.rusefi.io.CommandQueue;
|
||||||
import com.rusefi.io.ConnectionStatus;
|
|
||||||
import com.rusefi.waves.EngineChart;
|
import com.rusefi.waves.EngineChart;
|
||||||
import com.rusefi.waves.EngineReport;
|
import com.rusefi.waves.EngineReport;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static com.rusefi.IoUtil.*;
|
import static com.rusefi.IoUtil.*;
|
||||||
import static com.rusefi.IoUtil.getEnableCommand;
|
import static com.rusefi.IoUtil.getEnableCommand;
|
||||||
|
@ -72,12 +70,21 @@ public class AutoTest {
|
||||||
testFordFiesta();
|
testFordFiesta();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Function<String, Object> FAIL = new Function<String, Object>() {
|
||||||
|
@Override
|
||||||
|
public Object apply(String errorCode) {
|
||||||
|
if (errorCode != null)
|
||||||
|
throw new IllegalStateException("Failed " + errorCode);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private static void testVW_60_2() {
|
private static void testVW_60_2() {
|
||||||
setEngineType(32);
|
setEngineType(32);
|
||||||
changeRpm(900);
|
changeRpm(900);
|
||||||
// TODO: we shall get this RPM higher!
|
// TODO: we shall get this RPM higher!
|
||||||
// first let's get to expected RPM
|
// first let's get to expected RPM
|
||||||
assertRpmDoesNotJump(2000);
|
assertRpmDoesNotJump(2000, 4, 30, FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void testV12() {
|
private static void testV12() {
|
||||||
|
@ -85,25 +92,24 @@ public class AutoTest {
|
||||||
changeRpm(700);
|
changeRpm(700);
|
||||||
// TODO: we shall get this RPM higher!
|
// TODO: we shall get this RPM higher!
|
||||||
// first let's get to expected RPM
|
// first let's get to expected RPM
|
||||||
assertRpmDoesNotJump(1200);
|
assertRpmDoesNotJump(1200, 4, 30, FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertRpmDoesNotJump(int rpm) {
|
public static void assertRpmDoesNotJump(int rpm, int settleTime, int testDuration, Function<String, Object> callback) {
|
||||||
changeRpm(rpm);
|
changeRpm(rpm);
|
||||||
sleep(4);
|
sleep(settleTime);
|
||||||
AtomicReference failure = new AtomicReference();
|
AtomicReference<String> result = new AtomicReference<>();
|
||||||
SensorCentral.SensorListener listener = new SensorCentral.SensorListener() {
|
SensorCentral.SensorListener listener = new SensorCentral.SensorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSensorUpdate(double value) {
|
public void onSensorUpdate(double value) {
|
||||||
double actualRpm = SensorCentral.getInstance().getValue(Sensor.RPM);
|
double actualRpm = SensorCentral.getInstance().getValue(Sensor.RPM);
|
||||||
if (!isCloseEnough(rpm, actualRpm))
|
if (!isCloseEnough(rpm, actualRpm))
|
||||||
failure.set("Got " + actualRpm + " while trying to stay at " + rpm);
|
result.set("Got " + actualRpm + " while trying to stay at " + rpm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
SensorCentral.getInstance().addListener(Sensor.RPM, listener);
|
SensorCentral.getInstance().addListener(Sensor.RPM, listener);
|
||||||
sleep(30);
|
sleep(testDuration);
|
||||||
if (failure.get() != null)
|
callback.apply(result.get());
|
||||||
throw new IllegalStateException("Failed " + failure.get());
|
|
||||||
SensorCentral.getInstance().removeListener(Sensor.RPM, listener);
|
SensorCentral.getInstance().removeListener(Sensor.RPM, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see EngineSnifferPanel
|
* @see EngineSnifferPanel
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20200422;
|
public static final int CONSOLE_VERSION = 20200424;
|
||||||
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
||||||
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
||||||
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.rusefi.ui.widgets;
|
package com.rusefi.ui.widgets;
|
||||||
|
|
||||||
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
||||||
|
import com.rusefi.AutoTest;
|
||||||
import com.rusefi.FileLog;
|
import com.rusefi.FileLog;
|
||||||
import com.rusefi.InfixConverter;
|
import com.rusefi.InfixConverter;
|
||||||
import com.rusefi.core.MessagesCentral;
|
import com.rusefi.core.MessagesCentral;
|
||||||
|
@ -19,6 +20,7 @@ import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date: 3/20/13
|
* Date: 3/20/13
|
||||||
|
@ -113,7 +115,7 @@ public class AnyCommand {
|
||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
/**
|
/**
|
||||||
* {@link #DECODE_RPN} for example does not send out anything
|
* {@link #DECODE_RPN} for example does not send out anything
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (listener != null)
|
if (listener != null)
|
||||||
|
@ -128,6 +130,9 @@ public class AnyCommand {
|
||||||
try {
|
try {
|
||||||
if (rawCommand.startsWith("eval" + " ")) {
|
if (rawCommand.startsWith("eval" + " ")) {
|
||||||
return prepareEvalCommand(rawCommand);
|
return prepareEvalCommand(rawCommand);
|
||||||
|
} else if (rawCommand.toLowerCase().startsWith("stim_check" + " ")) {
|
||||||
|
handleStimulationSelfCheck(rawCommand);
|
||||||
|
return null;
|
||||||
} else if (rawCommand.toLowerCase().startsWith(DECODE_RPN + " ")) {
|
} else if (rawCommand.toLowerCase().startsWith(DECODE_RPN + " ")) {
|
||||||
handleDecodeRpn(rawCommand);
|
handleDecodeRpn(rawCommand);
|
||||||
return null;
|
return null;
|
||||||
|
@ -142,6 +147,33 @@ public class AnyCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void handleStimulationSelfCheck(String rawCommand) {
|
||||||
|
String[] parts = rawCommand.split(" ", 4);
|
||||||
|
if (parts.length != 3)
|
||||||
|
return; // let's ignore invalid command
|
||||||
|
int rpm = Integer.parseInt(parts[1]);
|
||||||
|
int settleTime = Integer.parseInt(parts[2]);
|
||||||
|
int durationTime = Integer.parseInt(parts[3]);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MessagesCentral.getInstance().postMessage(AnyCommand.class, "Will test with RPM" + rpm + ", settle time" + settleTime + "s and duration" + durationTime + "s");
|
||||||
|
Function<String, Object> callback = new Function<String, Object>() {
|
||||||
|
@Override
|
||||||
|
public Object apply(String status) {
|
||||||
|
if (status == null) {
|
||||||
|
MessagesCentral.getInstance().postMessage(AnyCommand.class, rpm + " worked!");
|
||||||
|
} else {
|
||||||
|
MessagesCentral.getInstance().postMessage(AnyCommand.class, rpm + " failed " + status);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AutoTest.assertRpmDoesNotJump(rpm, settleTime, durationTime, callback);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
private static String prepareSetFsioCommand(String rawCommand) {
|
private static String prepareSetFsioCommand(String rawCommand) {
|
||||||
String[] parts = rawCommand.split(" ", 3);
|
String[] parts = rawCommand.split(" ", 3);
|
||||||
if (parts.length != 3)
|
if (parts.length != 3)
|
||||||
|
|
Loading…
Reference in New Issue