From 40c56722a7985d207eb40f333c9cc2adc25e8bfa Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 21 Dec 2019 23:15:50 -0500 Subject: [PATCH] functional testing should not be that darn slow #1076 nicer logging --- java_console/autotest/src/com/rusefi/IoUtil.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/java_console/autotest/src/com/rusefi/IoUtil.java b/java_console/autotest/src/com/rusefi/IoUtil.java index 9202690d7d..5f186a4b2c 100644 --- a/java_console/autotest/src/com/rusefi/IoUtil.java +++ b/java_console/autotest/src/com/rusefi/IoUtil.java @@ -37,6 +37,9 @@ public class IoUtil { return Fields.CMD_DISABLE + " " + settingName; } + /** + * blocking method which would for confirmation from rusEfi + */ static void sendCommand(String command, int retryTimeoutMs, int totalTimeoutSeconds) { final CountDownLatch responseLatch = new CountDownLatch(1); long time = System.currentTimeMillis(); @@ -68,6 +71,7 @@ public class IoUtil { } static void changeRpm(final int rpm) { + FileLog.MAIN.logLine("AUTOTEST rpm EN " + rpm); sendCommand("rpm " + rpm); long time = System.currentTimeMillis(); @@ -86,7 +90,6 @@ public class IoUtil { } catch (InterruptedException e) { throw new IllegalStateException(e); } - FileLog.MAIN.logLine("RPM change [" + rpm + "] executed in " + (System.currentTimeMillis() - time)); SensorCentral.getInstance().removeListener(Sensor.RPM, listener); double actualRpm = SensorCentral.getInstance().getValue(Sensor.RPM); @@ -94,17 +97,13 @@ public class IoUtil { if (!isCloseEnough(rpm, actualRpm)) throw new IllegalStateException("rpm change did not happen: " + rpm + ", actual " + actualRpm); sendCommand(Fields.CMD_RESET_ENGINE_SNIFFER); + FileLog.MAIN.logLine("AUTOTEST RPM change [" + rpm + "] executed in " + (System.currentTimeMillis() - time)); } static void waitForFirstResponse() throws InterruptedException { FileLog.MAIN.logLine("Let's give it some time to start..."); final CountDownLatch startup = new CountDownLatch(1); - SensorCentral.SensorListener listener = new SensorCentral.SensorListener() { - @Override - public void onSensorUpdate(double value) { - startup.countDown(); - } - }; + SensorCentral.SensorListener listener = value -> startup.countDown(); long waitStart = System.currentTimeMillis(); SensorCentral.getInstance().addListener(Sensor.RPM, listener); startup.await(5, TimeUnit.SECONDS);