mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Create smoketest mode (#1264)
Create test mode that exists after confirming libraries load OK
This commit is contained in:
@@ -65,6 +65,7 @@ public class Main {
|
||||
private static final boolean isRelease = PhotonVersion.isRelease;
|
||||
|
||||
private static boolean isTestMode = false;
|
||||
private static boolean isSmoketest = false;
|
||||
private static Path testModeFolder = null;
|
||||
private static boolean printDebugLogs;
|
||||
|
||||
@@ -90,6 +91,11 @@ public class Main {
|
||||
"clear-config",
|
||||
false,
|
||||
"Clears PhotonVision pipeline and networking settings. Preserves log files");
|
||||
options.addOption(
|
||||
"s",
|
||||
"smoketest",
|
||||
false,
|
||||
"Exit Photon after loading native libraries and camera configs, but before starting up camera runners");
|
||||
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
CommandLine cmd = parser.parse(options, args);
|
||||
@@ -127,6 +133,10 @@ public class Main {
|
||||
if (cmd.hasOption("clear-config")) {
|
||||
ConfigManager.getInstance().clearConfig();
|
||||
}
|
||||
|
||||
if (cmd.hasOption("smoketest")) {
|
||||
isSmoketest = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -337,11 +347,17 @@ public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
TestUtils.loadLibraries();
|
||||
logger.info("Native libraries loaded.");
|
||||
boolean success = TestUtils.loadLibraries();
|
||||
|
||||
if (!success) {
|
||||
logger.error("Failed to load native libraries! Giving up :(");
|
||||
System.exit(1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to load native libraries!", e);
|
||||
System.exit(1);
|
||||
}
|
||||
logger.info("Native libraries loaded.");
|
||||
|
||||
try {
|
||||
if (Platform.isRaspberryPi()) {
|
||||
@@ -412,6 +428,11 @@ public class Main {
|
||||
NeuralNetworkModelManager.getInstance()
|
||||
.initialize(ConfigManager.getInstance().getModelsDirectory());
|
||||
|
||||
if (isSmoketest) {
|
||||
logger.info("PhotonVision base functionality loaded -- smoketest complete");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
if (!isTestMode) {
|
||||
logger.debug("Loading VisionSourceManager...");
|
||||
VisionSourceManager.getInstance()
|
||||
|
||||
Reference in New Issue
Block a user