allowing functional test from console command line
This commit is contained in:
parent
86e45aec00
commit
435211b161
|
@ -1,6 +1,7 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.io.LinkManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.rusefi.AutoTest.mainTestBody;
|
||||
import static com.rusefi.Timeouts.SECOND;
|
||||
|
@ -17,28 +18,37 @@ public class RealHwTest {
|
|||
System.out.println("Sleeping " + STARTUP_SLEEP + " seconds to give OS time to connect VCP driver");
|
||||
Thread.sleep(STARTUP_SLEEP * SECOND);
|
||||
long start = System.currentTimeMillis();
|
||||
String port = startRealHardwareTest(args);
|
||||
|
||||
if (port == null)
|
||||
return;
|
||||
boolean failed = false;
|
||||
try {
|
||||
runRealHardwareTest(port);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
failed = true;
|
||||
}
|
||||
if (failed)
|
||||
boolean isSuccess = runHardwareTest(args, start);
|
||||
if (!isSuccess)
|
||||
System.exit(-1);
|
||||
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
FileLog.MAIN.logLine("++++++++++++++++++++++++++++++++++++ Real Hardware Test Passed +++++++++++++++");
|
||||
FileLog.MAIN.logLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
long time = (System.currentTimeMillis() - start) / 1000;
|
||||
FileLog.MAIN.logLine("Done in " + time + "secs");
|
||||
System.exit(0); // this is a safer method eliminating the issue of non-daemon threads
|
||||
}
|
||||
|
||||
static String startRealHardwareTest(String[] args) {
|
||||
/**
|
||||
* @return true if test is a SUCCESS, false if a FAILURE
|
||||
*/
|
||||
public static boolean runHardwareTest(String[] args, long start) {
|
||||
String port = startRealHardwareTest(args);
|
||||
if (port == null) {
|
||||
return false;
|
||||
} else {
|
||||
try {
|
||||
runRealHardwareTest(port);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
long time = (System.currentTimeMillis() - start) / 1000;
|
||||
FileLog.MAIN.logLine("Done in " + time + "secs");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static String startRealHardwareTest(@NotNull String[] args) {
|
||||
/**
|
||||
* with real hardware we have noise on all analog inputs which gives us random sensor data, we cannot really
|
||||
* test exact numbers yet
|
||||
|
|
|
@ -60,6 +60,7 @@ public class Launcher {
|
|||
private static final String TOOL_NAME_COMPILE_FSIO_FILE = "compile_fsio_file";
|
||||
private static final String TOOL_NAME_REBOOT_ECU = "reboot_ecu";
|
||||
private static final String TOOL_NAME_FIRING_ORDER = "firing_order";
|
||||
private static final String TOOL_NAME_FUNCTIONAL_TEST = "functional_test";
|
||||
private static final String TOOL_NAME_PERF_ENUMS = "ptrace_enums";
|
||||
// todo: rename to something more FSIO-specific? would need to update documentation somewhere
|
||||
private static final String TOOL_NAME_COMPILE = "compile";
|
||||
|
@ -322,6 +323,11 @@ public class Launcher {
|
|||
public static void main(final String[] args) throws Exception {
|
||||
String toolName = args.length == 0 ? null : args[0];
|
||||
|
||||
if (TOOL_NAME_FUNCTIONAL_TEST.equals(toolName)) {
|
||||
RealHwTest.main(new String[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TOOL_NAME_COMPILE_FSIO_FILE.equalsIgnoreCase(toolName)) {
|
||||
int returnCode = invokeCompileFileTool(args);
|
||||
System.exit(returnCode);
|
||||
|
|
Loading…
Reference in New Issue