public final class ReflectionExecutor
extends java.lang.Object
If a test exceeds the timeout, it is canceled and reported as a timeout. When --usethreads
is true, each test is run on a separate thread, in parallel but not in isolation
(that is, not starting from a fresh JVM).
Modifier and Type | Field and Description |
---|---|
static int |
call_timeout_millis
After this many milliseconds, a non-returning method call, and its associated test, are stopped
forcefully.
|
static int |
CALL_TIMEOUT_MILLIS_DEFAULT
Default for call_timeout_millis, in milliseconds.
|
private static int |
excep_exec_count
The number of exceptional executions.
|
private static long |
excep_exec_duration_nanos
The sum of durations for exceptional executions, in nanoseconds.
|
private static int |
normal_exec_count
The number of normal executions.
|
private static long |
normal_exec_duration_nanos
The sum of durations for normal executions, in nanoseconds.
|
static org.plumelib.util.FileWriterWithName |
timed_out_tests
If specified, Randoop logs timed-out tests to the specified file.
|
static boolean |
usethreads
If true, Randoop executes each test in a separate thread and kills tests that take too long to
finish, as determined by the
--call-timeout-millis command-line argument. |
Modifier | Constructor and Description |
---|---|
private |
ReflectionExecutor() |
Modifier and Type | Method and Description |
---|---|
static double |
excepExecAvgMillis()
Returns the average exceptional execution time, in milliseconds.
|
static int |
excepExecs() |
static ExecutionOutcome |
executeReflectionCode(ReflectionCode code)
Executes
code.runReflectionCode() , which sets code 's ReflectionCode.retval or ReflectionCode.exceptionThrown field. |
private static void |
executeReflectionCodeThreaded(ReflectionCode code)
Executes code.runReflectionCode() in its own thread.
|
private static void |
executeReflectionCodeUnThreaded(ReflectionCode code)
Executes code.runReflectionCode() in the current thread.
|
static double |
normalExecAvgMillis()
Returns the average normal execution time, in milliseconds.
|
static int |
normalExecs() |
static void |
resetStatistics()
Set statistics about normal and exceptional executions to zero.
|
public static boolean usethreads
--call-timeout-millis
command-line argument. Tests killed
in this manner are not reported to the user, but are recorded in Randoop's log. Use the --log
command-line option to make Randoop produce the log.
Use this option if Randoop does not terminate, which is usually due to execution of code under test that results in an infinite loop or that waits for user input. The downside of this option is a BIG (order-of-magnitude) decrease in generation speed. The tests are run in parallel, but not in isolation.
public static org.plumelib.util.FileWriterWithName timed_out_tests
--usethreads
command-line option is given.public static int CALL_TIMEOUT_MILLIS_DEFAULT
checkOptionsValid()
.public static int call_timeout_millis
--usethreads
is also specified.private static long normal_exec_duration_nanos
private static int normal_exec_count
private static long excep_exec_duration_nanos
private static int excep_exec_count
public static void resetStatistics()
public static int normalExecs()
public static int excepExecs()
public static double normalExecAvgMillis()
public static double excepExecAvgMillis()
public static ExecutionOutcome executeReflectionCode(ReflectionCode code)
code.runReflectionCode()
, which sets code
's ReflectionCode.retval
or ReflectionCode.exceptionThrown
field.code
- the ReflectionCode
to be executedprivate static void executeReflectionCodeThreaded(ReflectionCode code) throws java.util.concurrent.TimeoutException
code
- the ReflectionCode
to be executedjava.util.concurrent.TimeoutException
- if execution times outprivate static void executeReflectionCodeUnThreaded(ReflectionCode code)
code
- the ReflectionCode
to be executed