Skip to content

Commit d475896

Browse files
PolyProgrammistladisgin
authored andcommitted
Update DEVNOTE.md: provide more details about docker login, cloning repo and troubleshooting
1 parent 4886622 commit d475896

File tree

4 files changed

+49
-13
lines changed

4 files changed

+49
-13
lines changed

DEVNOTE.md

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
UTBot has many dependencies, so the easiest way to build the tool from source and develop it is to use the docker container.
44

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).
66
It contains all the needed dependencies such as Git, LLVM, GRPC, GoogleTest and so on. **base_env** has multiple versions tagged with dates.
77
If you are developing the tool, you are most likely to need the most recent version.
88

@@ -12,24 +12,26 @@ To build UTBot from sources:
1212
```
1313
docker plugin install lebokus/bindfs
1414
```
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.
1617
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
1920

2021
`ssh utbot@host -p $port`
2122

2223
If you are prompted a password, type in `utbot`.
2324

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.
3032
![Oops, something went wrong! Please look at wizardInstall.gif](media/wizardInstall.gif "UTBot Wizard Demo")
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).
3335

3436
If you want to change UTBot test generation preferences, you can edit them in File > Preferences > Settings > Extensions > UnitTestBot.
3537
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:
4547
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.
4648
5. All other fields should fill in automatically.
4749

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 {}=[]).
79+
```
80+
Remove the following line in utbot_docker_dev.sh:
81+
```shell
82+
-v $MOUNT_LOCAL_NAME:/home/utbot/mnt \
83+
```

build.sh

100644100755
File mode changed.

docker/utbot_docker_dev.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
#
44
# Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.

vscode-plugin/build.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)