|
| 1 | +## How to build UTBotCpp from source |
| 2 | + |
| 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 | + |
| 5 | +UTBot has a published package called [base_env](https://github.com/UnitTestBot/UTBotCpp/pkgs/container/utbotcpp%2Fbase_env). |
| 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 | +If you are developing the tool, you are most likely to need the most recent version. |
| 8 | + |
| 9 | +To build UTBot from sources: |
| 10 | +1. Install [docker](https://docs.docker.com/engine/install/ubuntu/) |
| 11 | +2. Run the command |
| 12 | + ``` |
| 13 | + docker plugin install lebokus/bindfs |
| 14 | + ``` |
| 15 | +3. Run `utbot_docker_dev.sh` script. It will unpack the docker image and mount UTBot sources inside it. |
| 16 | + 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 |
| 19 | + |
| 20 | + `ssh utbot@host -p $port` |
| 21 | + |
| 22 | + If you are prompted a password, type in `utbot`. |
| 23 | + |
| 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 press F5. This will build and run UTBot VS Code plugin. |
| 27 | +8. 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. |
| 28 | +9. When UTBot Quickstart Wizard requests you to enter server host and port, specify `localhost` and UTBot server run port, respectively. |
| 29 | +  |
| 30 | +6. Select project path as `/home/utbot/UTBotCpp/integration-tests/c-example`; |
| 31 | +7. You are now ready to experience UTBot capabilities! You can view possible commands in Command Palette (Press F1 and type in UTBot). |
| 32 | + |
| 33 | +If you want to change UTBot test generation preferences, you can edit them in File > Preferences > Settings > Extensions > UnitTestBot. |
| 34 | +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. |
| 35 | + |
| 36 | +## How to develop UTBotCpp with an IDE |
| 37 | + |
| 38 | +You can edit UTBot sources, rebuild and rerun the server with an IDE. Usually, CLion *Remote host* toolchain is used for it. |
| 39 | + |
| 40 | +To setup it: |
| 41 | +1. Open UTBotCpp project with CLion on your local machine. |
| 42 | +2. Open **Settings > Build, Execution, Deployment > Toolchains**. |
| 43 | +3. Add a new *Remote Host* toolchain. |
| 44 | +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. |
| 45 | +5. All other fields should fill in automatically. |
| 46 | + |
0 commit comments