Skip to content

Commit

Permalink
testability: bench test commands should have automated coverage using…
Browse files Browse the repository at this point in the history
… simulator #5562
  • Loading branch information
rusefillc committed Sep 12, 2023
1 parent c64981d commit 6182d7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions java_console/autotest/src/main/java/com/rusefi/IoUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ private static void waitForFirstResponse() throws InterruptedException {
long waitStart = System.currentTimeMillis();

ISensorCentral.ListenerToken listener = SensorCentral.getInstance().addListener(Sensor.RPMValue, value -> startup.countDown());
boolean haveResponse = startup.await(10, TimeUnit.SECONDS);
boolean haveResponse = startup.await(60, TimeUnit.SECONDS);
if (!haveResponse)
throw new IllegalStateException("No response from simulator");
listener.remove();
FileLog.MAIN.logLine("Got first signal in " + (System.currentTimeMillis() - waitStart));
FileLog.MAIN.logLine("Got first signal in " + (System.currentTimeMillis() - waitStart) + "ms");
}

public static void connectToSimulator(LinkManager linkManager, boolean startProcess) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;

import static com.rusefi.SimulatorFunctionalTestLauncher.isHappy;

/**
* 3/18/14
* Andrey Belomutskiy, (c) 2013-2020
Expand Down Expand Up @@ -43,7 +45,11 @@ private static void runSimulator() {

System.out.println("end of console");
} catch (Exception err) {
throw new IllegalStateException(err);
if (isHappy) {
System.out.println("Already happy " + err);
} else {
throw new IllegalStateException(err);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* As of Dec 2020 this seems very broken?
*/
public class SimulatorFunctionalTestLauncher {
static boolean isHappy;
public static void main(String[] args) {
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
e.printStackTrace();
Expand All @@ -32,8 +33,9 @@ public static void main(String[] args) {
}
if (failed)
System.exit(-1);
isHappy = true;
FileLog.MAIN.logLine("*******************************************************************************");
FileLog.MAIN.logLine("************************************ Looks good! *****************************");
FileLog.MAIN.logLine("**** SimulatorFunctionalTestLauncher Looks good! *****************************");
FileLog.MAIN.logLine("*******************************************************************************");
long time = (System.currentTimeMillis() - start) / 1000;
FileLog.MAIN.logLine("Done in " + time + "secs");
Expand Down

0 comments on commit 6182d7e

Please sign in to comment.