testability: bench test commands should have automated coverage using simulator #5562
This commit is contained in:
parent
c64981d1e5
commit
6182d7e3fa
|
@ -110,11 +110,11 @@ public class IoUtil {
|
||||||
long waitStart = System.currentTimeMillis();
|
long waitStart = System.currentTimeMillis();
|
||||||
|
|
||||||
ISensorCentral.ListenerToken listener = SensorCentral.getInstance().addListener(Sensor.RPMValue, value -> startup.countDown());
|
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)
|
if (!haveResponse)
|
||||||
throw new IllegalStateException("No response from simulator");
|
throw new IllegalStateException("No response from simulator");
|
||||||
listener.remove();
|
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 {
|
public static void connectToSimulator(LinkManager linkManager, boolean startProcess) throws InterruptedException {
|
||||||
|
|
|
@ -7,6 +7,8 @@ import java.io.InputStreamReader;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static com.rusefi.SimulatorFunctionalTestLauncher.isHappy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 3/18/14
|
* 3/18/14
|
||||||
* Andrey Belomutskiy, (c) 2013-2020
|
* Andrey Belomutskiy, (c) 2013-2020
|
||||||
|
@ -43,9 +45,13 @@ public class SimulatorExecHelper {
|
||||||
|
|
||||||
System.out.println("end of console");
|
System.out.println("end of console");
|
||||||
} catch (Exception err) {
|
} catch (Exception err) {
|
||||||
|
if (isHappy) {
|
||||||
|
System.out.println("Already happy " + err);
|
||||||
|
} else {
|
||||||
throw new IllegalStateException(err);
|
throw new IllegalStateException(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void dumpProcessOutput(Process process) throws IOException {
|
public static void dumpProcessOutput(Process process) throws IOException {
|
||||||
BufferedReader input =
|
BufferedReader input =
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.rusefi.io.LinkManager;
|
||||||
* As of Dec 2020 this seems very broken?
|
* As of Dec 2020 this seems very broken?
|
||||||
*/
|
*/
|
||||||
public class SimulatorFunctionalTestLauncher {
|
public class SimulatorFunctionalTestLauncher {
|
||||||
|
static boolean isHappy;
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
|
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -32,8 +33,9 @@ public class SimulatorFunctionalTestLauncher {
|
||||||
}
|
}
|
||||||
if (failed)
|
if (failed)
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
|
isHappy = true;
|
||||||
FileLog.MAIN.logLine("*******************************************************************************");
|
FileLog.MAIN.logLine("*******************************************************************************");
|
||||||
FileLog.MAIN.logLine("************************************ Looks good! *****************************");
|
FileLog.MAIN.logLine("**** SimulatorFunctionalTestLauncher Looks good! *****************************");
|
||||||
FileLog.MAIN.logLine("*******************************************************************************");
|
FileLog.MAIN.logLine("*******************************************************************************");
|
||||||
long time = (System.currentTimeMillis() - start) / 1000;
|
long time = (System.currentTimeMillis() - start) / 1000;
|
||||||
FileLog.MAIN.logLine("Done in " + time + "secs");
|
FileLog.MAIN.logLine("Done in " + time + "secs");
|
||||||
|
|
Loading…
Reference in New Issue