Skip to content

Commit 6e16f85

Browse files
Add summaries of ConcreteExecutor and Minimization in OverallArchitecture.md (#1532)
Add: docs on `ConcreteExecutor` and `Minimization` Co-authored-by: Olga Naumenko <[email protected]>
1 parent 409a028 commit 6e16f85

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

docs/OverallArchitecture.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,23 @@ It is used to [monitor and chart][contest estimator 4] statistics nightly.
147147
TODO (Alexey Menshutin)
148148

149149
### Concrete executor
150-
TODO (Sergey Pospelov)
150+
`ConcreteExecutor` is the input point for the instrumented process which is used by our symbolic and fuzzing engines. The main purpose of this class is to provide smooth and concise interaction between the instrumented process and users whereas the instrumented process executes a given function with supplied arguments.
151+
152+
`ConcreteExecutor` is parametrized by specific `Instrumentation` and its return type via generic arguments. `Instrumentation` is an interface, so inheritors have to implement the logic of invocation of a specific method in isolated environment as well as the `transform` function which is used for instrumenting classes. For our purposes we use `UtExecutionInstrumentation`.
153+
154+
The main function of `ConcreteExecutor` is
155+
```kotlin
156+
suspend fun executeAsync(
157+
kCallable: KCallable<*>,
158+
arguments: Array<Any?>,
159+
parameters: Any?
160+
): TResult
161+
```
162+
which serializes the arguments and some parameters (such as statics, etc.), sends it to the instrumented process and retrieves the result.
163+
164+
Internally `ConcreteExecutor` uses `RD` for interprocess communication and `Kryo` for objects serialization. You don't need to provide a marshaller, as `Kryo` serializes objects by itself (but sometimes it fails).
165+
166+
`ConcreteExecutor` is placed in the [utbot-instrumentation](../utbot-instrumentation) module and tests are placed in the [utbot-instrumentation-tests](../utbot-instrumentation-tests) module.
151167

152168
### Instrumented process
153169
TODO (Rustam Sadykov)
@@ -159,7 +175,25 @@ TODO (Egor Kulikov)
159175
TODO (Maxim Pelevin)
160176

161177
### Minimizer
162-
TODO (Sergey Pospelov)
178+
Minimization is used to decrease the amount of `UtExecution`s without coverage degradation.
179+
180+
The entry point is the [minimizeTestCase](https://github.com/UnitTestBot/UTBotJava/blob/d2d2e350bc75943b78f2078002a5cabc5dd62072/utbot-framework/src/main/kotlin/org/utbot/framework/minimization/Minimization.kt#L38) function. It receives a set of `UtExecution`s and a groupping function (it groups by `UtExecution::utExecutionResult`), then the minimization divides `UtExecution`s into several groups and each group is minimized independently.
181+
182+
We have different groups, here are some of them:
183+
- A successfull regression suite which consists of `UtSuccess` and `UtExplicitlyThrownException` executions.
184+
- An error suite which consists of `UtImplicitlyThrownException` executions.
185+
- A timeout suite which consists of `UtTimeoutException` executions.
186+
- A crash suite which consists of executions where some parts of the engine failed.
187+
- etc.
188+
189+
Each provided `UtExecution` should have a coverage information, otherwise we add this execution to the test suite instantly. A coverage data is usually obtained from the instrumented process and consists of covered lines.
190+
191+
To minimize executions inside a group we use a simple greedy algorithm:
192+
1. Pick an execution which provides the most yet uncovered lines.
193+
2. Add this execution to the final suite and mark new lines as covered
194+
3. Repeat from the first step till there are executions which contain uncovered lines.
195+
196+
The whole minimization code located in the [org.utbopt.framework.minimization](utbot-framework/src/main/kotlin/org/utbot/framework/minimization) package inside the [utbot-framework](../utbot-framework) module.
163197

164198
### Summaries
165199
The summarization process includes the generation of the following meta-information:

0 commit comments

Comments
 (0)