trigger and VSS hw integrated testing #1668

This commit is contained in:
rusefi 2020-08-08 11:57:39 -04:00
parent ee2cb762c6
commit 5fe1eaf03c
1 changed files with 11 additions and 8 deletions

View File

@ -1,11 +1,14 @@
package com.rusefi; package com.rusefi;
import com.devexperts.logging.Logging;
import com.rusefi.autodetect.PortDetector;
import com.rusefi.io.LinkManager; import com.rusefi.io.LinkManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.Timeouts.SECOND; import static com.rusefi.Timeouts.SECOND;
/** /**
@ -14,18 +17,19 @@ import static com.rusefi.Timeouts.SECOND;
* 2/22/2015 * 2/22/2015
*/ */
public class RealHwTest { public class RealHwTest {
private static final Logging log = getLogging(RealHwTest.class);
private static final int STARTUP_SLEEP = 20; private static final int STARTUP_SLEEP = 20;
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
System.out.println("Sleeping " + STARTUP_SLEEP + " seconds to give OS time to connect VCP driver"); log.info("Sleeping " + STARTUP_SLEEP + " seconds to give OS time to connect VCP driver");
Thread.sleep(STARTUP_SLEEP * SECOND); Thread.sleep(STARTUP_SLEEP * SECOND);
boolean isSuccess = runHardwareTest(args); boolean isSuccess = runHardwareTest(args);
if (!isSuccess) if (!isSuccess)
System.exit(-1); System.exit(-1);
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ Real Hardware Test Passed +++++++++++++++"); log.info("++++++++++++++++++++++++++++++++++++ Real Hardware Test Passed +++++++++++++++");
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.exit(0); // this is a safer method eliminating the issue of non-daemon threads System.exit(0); // this is a safer method eliminating the issue of non-daemon threads
} }
@ -52,12 +56,12 @@ public class RealHwTest {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw); e.printStackTrace(pw);
FileLog.MAIN.logLine("Test failed: " + e + " at " + sw); log.info("Test failed: " + e + " at " + sw);
e.printStackTrace(); e.printStackTrace();
return false; return false;
} }
long time = (System.currentTimeMillis() - start) / 1000; long time = (System.currentTimeMillis() - start) / 1000;
FileLog.MAIN.logLine("Done in " + time + "secs"); log.info("Done in " + time + "secs");
return true; return true;
} }
@ -72,8 +76,7 @@ public class RealHwTest {
if (args.length == 1 || args.length == 2) { if (args.length == 1 || args.length == 2) {
port = args[0]; port = args[0];
} else if (args.length == 0) { } else if (args.length == 0) {
// todo: reuse 'PortDetector.autoDetectPort' here? port = PortDetector.autoDetectPort(null);
port = LinkManager.getDefaultPort();
} else { } else {
System.out.println("Only one optional argument expected: port number"); System.out.println("Only one optional argument expected: port number");
port = null; port = null;