testability: bench test commands should have automated coverage using simulator #5562

This commit is contained in:
Andrey 2023-09-12 00:36:26 -04:00
parent c64981d1e5
commit 6182d7e3fa
3 changed files with 12 additions and 4 deletions

View File

@ -110,11 +110,11 @@ public class IoUtil {
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 {

View File

@ -7,6 +7,8 @@ import java.io.InputStreamReader;
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
@ -43,7 +45,11 @@ public class SimulatorExecHelper {
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);
}
}
}

View File

@ -7,6 +7,7 @@ import com.rusefi.io.LinkManager;
* 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();
@ -32,8 +33,9 @@ public class SimulatorFunctionalTestLauncher {
}
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");