hard kill test on timeout during setup
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-08-29 14:53:51 -04:00
parent 04b48c0c3b
commit 637230c744
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,7 @@
package electrosphere.engine.threads; package electrosphere.engine.threads;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
@ -82,6 +84,14 @@ public class ThreadManager {
return loadingThreads.size() > 0; return loadingThreads.size() > 0;
} }
/**
* Gets the list of loading threads
* @return The list of loading threads
*/
public List<LoadingThread> getLoadingThreads(){
return Collections.unmodifiableList(loadingThreads);
}
/** /**
* Tries to close all threads * Tries to close all threads
*/ */

View File

@ -8,6 +8,9 @@ import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
public class EngineInit { public class EngineInit {
//The maximum number of frames to wait before failing the startup routine
public static final int MAX_FRAMES_TO_WAIT = 1000;
/** /**
* Setups up a locally-connected client and server that have loaded a test scene * Setups up a locally-connected client and server that have loaded a test scene
*/ */
@ -19,6 +22,7 @@ public class EngineInit {
// //
//wait for client to be fully init'd //wait for client to be fully init'd
int frames = 0;
while(Globals.threadManager.isLoading()){ while(Globals.threadManager.isLoading()){
TestEngineUtils.simulateFrames(1); TestEngineUtils.simulateFrames(1);
try { try {
@ -26,6 +30,16 @@ public class EngineInit {
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
frames++;
if(frames > MAX_FRAMES_TO_WAIT){
String errorMessage = "Failed to setup connected test scene!\n" +
"Still running threads are:\n"
;
for(LoadingThread thread : Globals.threadManager.getLoadingThreads()){
errorMessage = errorMessage + thread.getType() + "\n";
}
throw new IllegalStateException(errorMessage);
}
} }
} }