You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVNOTE.md
+48-12Lines changed: 48 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
UTBot has many dependencies, so the easiest way to build the tool from source and develop it is to use the docker container.
4
4
5
-
UTBot has a published package called [base_env](https://github.com/UnitTestBot/UTBotCpp/pkgs/container/utbotcpp%2Fbase_env).
5
+
UTBot has a published package called [base_env](https://github.com/UnitTestBot/UTBotCpp/pkgs/container/utbotcpp%2Fbase_env).
6
6
It contains all the needed dependencies such as Git, LLVM, GRPC, GoogleTest and so on. **base_env** has multiple versions tagged with dates.
7
7
If you are developing the tool, you are most likely to need the most recent version.
8
8
@@ -12,24 +12,26 @@ To build UTBot from sources:
12
12
```
13
13
docker plugin install lebokus/bindfs
14
14
```
15
-
3. Run `utbot_docker_dev.sh` script. It will unpack the docker image and mount UTBot sources inside it.
15
+
3. You need to do `docker login` to `ghcr.io` as described [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry).
16
+
4. Run `utbot_docker_dev.sh`[script](https://github.com/UnitTestBot/UTBotCpp/blob/main/docker/utbot_docker_dev.sh). It will unpack the docker image and mount UTBot sources inside it.
16
17
UTBot binary can be built in the docker and run in it.
17
-
The script will prompt you to enter an`ssh` port required to ssh into the container using `ssh utbot@host -p $port`, where `host` is docker host IP address (it may be `localhost`). Please, specify a port that is not taken by any process. Also, you will be prompted to enter a port where UTBot itself will be run.
18
-
4. Get access to the container via
18
+
The script will prompt you to enter docker image tag. You can find the most recent tag [here](https://github.com/UnitTestBot/UTBotCpp/pkgs/container/utbotcpp%2Fbase_env), for example `24-11-2021`. Also it will ask about`ssh` port required to ssh into the container using `ssh utbot@host -p $port`, where `host` is docker host IP address (it may be `localhost`). Please, specify a port that is not taken by any process. Also, you will be prompted to enter a port where UTBot itself will be run.
19
+
5. Get access to the container via
19
20
20
21
`ssh utbot@host -p $port`
21
22
22
23
If you are prompted a password, type in `utbot`.
23
24
24
-
5.`cd` into `UTBotCpp` directory and run `build.sh` — it is the script that builds KLEE UTBot and runs UTBot unit tests
25
-
6. Navigate to `UTBotCpp/server/build` directory and launch the binary with `./utbot server` command. Now the server is running.
26
-
7. Launch VS Code on your local machine. Use VS Code [Remote-SSH](https://code.visualstudio.com/docs/remote/ssh) to get access to the docker insides. Navigate to `UTBotCpp/vscode-plugin` directory and run `build.sh` script.
27
-
8. Press F5 (*Run Extension*). This will run UTBot VS Code plugin.
28
-
9. A new VS Code window will open; this window will have UTBot VS Code plugin enabled. In this new folder, open `UTBotCpp/integration-tests/c-example` directory.
29
-
10. When UTBot Quickstart Wizard requests you to enter server host and port, specify `localhost` and UTBot server run port, respectively.
25
+
5. Clone UTBotCpp repository into home directory inside docker container, preferably with ssh. And don't forget to clone modules with `git submodule update --init --recursive`
26
+
6.`cd` into `UTBotCpp` directory and run `build.sh` — it is the script that builds KLEE UTBot and runs UTBot unit tests
27
+
7. Navigate to `UTBotCpp/server/build` directory and launch the binary with `./utbot server` command. Now the server is running.
28
+
8. Launch VS Code on your local machine. Use VS Code [Remote-SSH](https://code.visualstudio.com/docs/remote/ssh) to get access to the docker insides. Navigate to `UTBotCpp/vscode-plugin` directory and run `build.sh` script.
29
+
9. Press F5 (*Run Extension*). This will run UTBot VS Code plugin.
30
+
10. A new VS Code window will open; this window will have UTBot VS Code plugin enabled. In this new folder, open `UTBotCpp/integration-tests/c-example` directory.
31
+
11. When UTBot Quickstart Wizard requests you to enter server host and port, specify `localhost` and UTBot server run port 2121, respectively.
30
32

31
-
11. Select project path as `/home/utbot/UTBotCpp/integration-tests/c-example`;
32
-
12. You are now ready to experience UTBot capabilities! You can view possible commands in Command Palette (Press F1 and type in UTBot).
33
+
12. Select project path as `/home/utbot/UTBotCpp/integration-tests/c-example`;
34
+
13. You are now ready to experience UTBot capabilities! You can view possible commands in Command Palette (Press F1 and type in UTBot).
33
35
34
36
If you want to change UTBot test generation preferences, you can edit them in File > Preferences > Settings > Extensions > UnitTestBot.
35
37
After UTBot configuration, you can select your source directories with the tab on the VSCode toolbar on the left. Then, you can generate tests with the use of Command Palette. Press **F1** and type in "UTBot": You will see tests generation options.
@@ -45,3 +47,37 @@ To setup it:
45
47
4. In *Credentials* section, set up an `ssh` connection to the UTBot docker container you have. Consider enabling connection via OpehSSH authentification agent to ease files synchronization.
46
48
5. All other fields should fill in automatically.
47
49
50
+
51
+
## Troubleshooting the build
52
+
### read -i invalid option
53
+
You can experience this on Mac OS:
54
+
```shell
55
+
read: -i: invalid option
56
+
```
57
+
It is because Mac OS has too old bash version. Upgrade bash version and set it to default:
58
+
```shell
59
+
brew install bash
60
+
chsh -s /usr/local/bin/bash
61
+
```
62
+
### Problem with gRPC
63
+
If you experience this problem:
64
+
```shell
65
+
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.
66
+
/bin/grpc_cpp_plugin: program not found or is not executable
67
+
```
68
+
```shell
69
+
ninja: error: 'protobuf/testgen.grpc.pb.h', needed by 'CMakeFiles/utbot.dir/main.cpp.o', missing and no known rule to make it
70
+
```
71
+
Copy the program to /bin:
72
+
```shell
73
+
cp /utbot_distr/install/bin/grpc_cpp_plugin /bin/
74
+
```
75
+
### Error while mounting empty volume
76
+
If this error happens on Mac OS:
77
+
```shell
78
+
docker: Error response from daemon: error while mounting volume '': VolumeDriver.Mount: exit status 1%!(EXTRA []interface {}=[]).
0 commit comments