Skip to content

Commit d31a22a

Browse files
committed
[rd-refactoring]
Enabling suspend and port choosing by utsettings Run configurations for debugging Instant process death detection Orphan processes termination system Some text loading optimization ChildProcess -> InstrumentedProcess Rd-based UtSettings for InstrumentedProcess
1 parent c4ae051 commit d31a22a

File tree

59 files changed

+450
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+450
-247
lines changed

.github/workflows/build-and-run-tests-from-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
name: utbot_temp ${{ matrix.project.PART_NAME }}
132132
path: |
133133
/tmp/UTBot/generated*/*
134-
/tmp/UTBot/utbot-childprocess-errors/*
134+
/tmp/UTBot/utbot-instrumentedprocess-errors/*
135135
- name: Upload test report if tests have failed
136136
if: ${{ failure() }}
137137
uses: actions/upload-artifact@v3

.github/workflows/run-chosen-tests-from-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
name: generated-tests
6868
path: |
6969
/tmp/UTBot/generated*/*
70-
/tmp/UTBot/utbot-childprocess-errors/*
70+
/tmp/UTBot/utbot-instrumentedprocess-errors/*
7171
- name: Upload utbot-framework logs
7272
if: ${{ always() && github.event.inputs.project-name == 'utbot-framework' }}
7373
uses: actions/upload-artifact@v3

.run/Debug All.run.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Debug All" type="CompoundRunConfigurationType">
3+
<toRun name="Run IDE" type="GradleRunConfiguration" />
4+
<toRun name="Listen for Concrete Executor Process" type="Remote" />
5+
<toRun name="Listen for Engine Process" type="Remote" />
6+
<method v="2" />
7+
</configuration>
8+
</component>

.run/Debug Engine Process.run.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Debug Engine Process" type="CompoundRunConfigurationType">
3+
<toRun name="Run IDE" type="GradleRunConfiguration" />
4+
<toRun name="Listen for Engine Process" type="Remote" />
5+
<method v="2" />
6+
</configuration>
7+
</component>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Debug Instrumented Process" type="CompoundRunConfigurationType">
3+
<toRun name="Run IDE" type="GradleRunConfiguration" />
4+
<toRun name="Listen for Instrumented Process" type="Remote" />
5+
<method v="2" />
6+
</configuration>
7+
</component>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Listen for Engine Process" type="Remote" folderName="Utility Configurations">
3+
<option name="USE_SOCKET_TRANSPORT" value="true" />
4+
<option name="SERVER_MODE" value="true" />
5+
<option name="SHMEM_ADDRESS" />
6+
<option name="HOST" value="localhost" />
7+
<option name="PORT" value="5005" />
8+
<option name="AUTO_RESTART" value="true" />
9+
<RunnerSettings RunnerId="Debug">
10+
<option name="DEBUG_PORT" value="5005" />
11+
<option name="LOCAL" value="false" />
12+
</RunnerSettings>
13+
<method v="2" />
14+
</configuration>
15+
</component>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Listen for Instrumented Process" type="Remote" folderName="Utility Configurations">
3+
<option name="USE_SOCKET_TRANSPORT" value="true" />
4+
<option name="SERVER_MODE" value="true" />
5+
<option name="SHMEM_ADDRESS" />
6+
<option name="HOST" value="localhost" />
7+
<option name="PORT" value="5006" />
8+
<option name="AUTO_RESTART" value="true" />
9+
<RunnerSettings RunnerId="Debug">
10+
<option name="DEBUG_PORT" value="5006" />
11+
<option name="LOCAL" value="false" />
12+
</RunnerSettings>
13+
<method v="2" />
14+
</configuration>
15+
</component>

.run/Run IDE.run.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run IDE" type="GradleRunConfiguration" factoryName="Gradle">
3+
<ExternalSystemSettings>
4+
<option name="executionName" />
5+
<option name="externalProjectPath" value="$PROJECT_DIR$/utbot-intellij" />
6+
<option name="externalSystemIdString" value="GRADLE" />
7+
<option name="scriptParameters" value="" />
8+
<option name="taskDescriptions">
9+
<list />
10+
</option>
11+
<option name="taskNames">
12+
<list>
13+
<option value="runIde" />
14+
</list>
15+
</option>
16+
<option name="vmOptions" />
17+
</ExternalSystemSettings>
18+
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
19+
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
20+
<DebugAllEnabled>false</DebugAllEnabled>
21+
<method v="2" />
22+
</configuration>
23+
</component>

docs/RD for UnitTestBot.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,21 @@ Usefull:
112112
2. There are some usefull classes to work with processes & rd:
113113
- ```LifetimedProcess``` - binds ```Lifetime``` to process. If process dies - lifetime terminates and vice versa. You can terminate lifetime manually - this will destroy process.
114114
- ```ProcessWithRdServer``` - also starts Rd server and waits for connection.
115-
- ```UtInstrumentationProcess``` - encapsulates logic for preparing child process for executing arbitary commands. Exposes ```protocolModel``` for communicating with child process.
115+
- ```UtInstrumentationProcess``` - encapsulates logic for preparing instrumented process for executing arbitary commands. Exposes ```protocolModel``` for communicating with instrumented process.
116116
- ```ConcreteExecutor``` is convenient wrapper for executing commands and managing resources.
117117
3. How child communication works:
118118
- Choosing free port
119-
- Creating child process, passing port as argument
119+
- Creating instrumented process, passing port as argument
120120
- Both processes create protocols and bind model
121-
- Child process setups all callbacks
121+
- Instrumented process setups all callbacks
122122
- Parent process cannot send messages before child creates protocol, otherwise messages will be lost. So child process needs to signal that he is ready.
123-
- Child proces creates special file in temp dir, that is observed by parent process.
123+
- Instrumented proces creates special file in temp dir, that is observed by parent process.
124124
- When parent process spots file - he deletes it, and then sends special message for preparing child proccess instrumentation
125125
- Only then process is ready for executing commands
126126
4. How to write custom commands for child process
127127
- Add new ```call``` in ```ProtocolModel```
128128
- Regenerate models
129-
- Add callback for new ```call``` in ```ChildProcess.kt```
129+
- Add callback for new ```call``` in ```InstrumentedProcess.kt```
130130
- Use ```ConcreteExecutor.withProcess``` method
131131
- ___Important___ - do not add `Rdgen` as implementation dependency, it breaks some `.jar`s as it contains `kotlin-compiler-embeddable`.
132132
5. Logs

docs/contributing/InterProcessDebugging.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ The most straightforward way to debug the Engine process is the following.
1818

1919
1. Open `org/utbot/framework/UtSettings.kt`.
2020
2. Set `runIdeaProcessWithDebug` property to _true_. This enables `EngineProcess.debugArgument`.
21-
3. Find `EngineProcess.debugArgument` at `org/utbot/intellij/plugin/process/EngineProcess` and check the parameters of the debug run:
21+
* Alternatively you can create `~/.utbot/settings.properties` file and write following:
22+
```
23+
runIdeaProcessWithDebug=true
24+
```
25+
4. Find `EngineProcess.debugArgument` at `org/utbot/intellij/plugin/process/EngineProcess` and check the parameters of the debug run:
2226

2327
`"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,quiet=y,address=5005"`
2428

0 commit comments

Comments
 (0)