Class SlaveMain
java.lang.Object
com.carrotsearch.ant.tasks.junit4.slave.SlaveMain
A slave process running the actual tests on the target JVM.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classBase for redirected streams. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileDebug stream to flush progress information to.static final intRuntime exception.static final intNo JUnit on classpath.static final intOld JUnit on classpath.static final intOOMprivate booleanFlush serialization stream frequently.(package private) static ObjectLast resort memory pool released under low memory conditions.private static booleanMultiplex calls to System streams to both event stream and the original streams?(package private) static Class<OutOfMemoryError> Preallocate and load in advance.static final StringShould the debug stream from the runner be created? It's named after the events file with.debugsuffix.static final StringName the sink for events.static final StringFrequent event strean flushing.static final StringRead class names from standard input.static final StringMultiplex sysout and syserr to original streams (aside from pumping them to event stream).private final SerializerEvent sink.static final StringFire a runner failure after startup to verify messages are propagated properly.static final StringDelay the initial bootstrap event from the forked JVM (used in tests).private static PrintStreamA sink for warnings (non-event stream). -
Constructor Summary
ConstructorsConstructorDescriptionSlaveMain(Serializer serializer) Creates a slave emitting events to the given serializer. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidExecute tests.private Class<?> instantiate(String className) Instantiate test classes (or try to).static voidConsole entry point.private static String[]readArgsFile(String argsFile) Read arguments from a file.private static voidredirectStreams(Serializer serializer, boolean flushFrequently) Redirect standard streams so that the output can be passed to listeners.private static voidTry waiting for a GC to happen.static voidWarning emitter.
-
Field Details
-
ERR_EXCEPTION
public static final int ERR_EXCEPTIONRuntime exception.- See Also:
-
ERR_NO_JUNIT
public static final int ERR_NO_JUNITNo JUnit on classpath.- See Also:
-
ERR_OLD_JUNIT
public static final int ERR_OLD_JUNITOld JUnit on classpath.- See Also:
-
ERR_OOM
public static final int ERR_OOMOOM- See Also:
-
lastResortMemory
Last resort memory pool released under low memory conditions. This is not a solution, it's a terrible hack. I know this. Everyone knows this. Even monkeys in Madagaskar know this. If you know a better solution, patches welcome.Approximately 5mb is reserved. Really, smaller values don't make any difference and the JVM fails to even return the status passed to Runtime.halt().
-
oomClass
Preallocate and load in advance. -
OPTION_FREQUENT_FLUSH
-
OPTION_SYSOUTS
Multiplex sysout and syserr to original streams (aside from pumping them to event stream).- See Also:
-
OPTION_STDIN
-
OPTION_EVENTSFILE
Name the sink for events. If given, accepts one argument - name of a file to which events should be dumped. The file has to be initially empty!- See Also:
-
OPTION_DEBUGSTREAM
Should the debug stream from the runner be created? It's named after the events file with.debugsuffix.- See Also:
-
SYSPROP_FIRERUNNERFAILURE
Fire a runner failure after startup to verify messages are propagated properly. Not really useful in practice... -
SYSPROP_FORKEDJVM_DELAY_MS
Delay the initial bootstrap event from the forked JVM (used in tests).- See Also:
-
serializer
Event sink. -
warnings
A sink for warnings (non-event stream). -
flushFrequently
private boolean flushFrequentlyFlush serialization stream frequently. -
debugMessagesFile
Debug stream to flush progress information to. -
multiplexStdStreams
private static boolean multiplexStdStreamsMultiplex calls to System streams to both event stream and the original streams?
-
-
Constructor Details
-
SlaveMain
Creates a slave emitting events to the given serializer.
-
-
Method Details
-
execute
-
debug
- Throws:
IOException
-
instantiate
-
main
Console entry point. -
tryWaitingForGC
private static void tryWaitingForGC()Try waiting for a GC to happen. This is a dirty heuristic but if we're here we're neck deep in sh*t anyway (OOMs all over). -
readArgsFile
Read arguments from a file. Newline delimited, UTF-8 encoded. No fanciness to avoid dependencies.- Throws:
IOException
-
redirectStreams
Redirect standard streams so that the output can be passed to listeners. -
warn
-