Commit b1fbb342 authored by Ge Jun's avatar Ge Jun

move gtest installation before compilation

parent 38eacc9f
...@@ -38,6 +38,12 @@ If you need to enable cpu/heap profilers in examples: ...@@ -38,6 +38,12 @@ If you need to enable cpu/heap profilers in examples:
$ sudo apt-get install libgoogle-perftools-dev $ sudo apt-get install libgoogle-perftools-dev
``` ```
If you need to run tests, install and compile libgtest-dev (which is not compiled yet):
```shell
$ sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd -
```
The directory of gtest source code may be changed, try `/usr/src/googletest/googletest` if `/usr/src/gtest` is not there.
### Compile brpc with config_brpc.sh ### Compile brpc with config_brpc.sh
git clone brpc, cd into the repo and run git clone brpc, cd into the repo and run
```shell ```shell
...@@ -64,17 +70,12 @@ $ ./echo_client ...@@ -64,17 +70,12 @@ $ ./echo_client
Examples link brpc statically, if you need to link the shared version, `make clean` and `LINK_SO=1 make` Examples link brpc statically, if you need to link the shared version, `make clean` and `LINK_SO=1 make`
**Run tests** **Run tests**
Install and compile libgtest-dev (which is not compiled yet):
```shell ```shell
$ sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd - $ cd test
$ make
$ sh run_tests.sh
``` ```
The directory of gtest source code may be changed, try `/usr/src/googletest/googletest` if `/usr/src/gtest` is not there.
Rerun `config_brpc.sh`, `make` in test/, and `sh run_tests.sh`
### Compile brpc with cmake ### Compile brpc with cmake
```shell ```shell
$ mkdir build && cd build && cmake .. && make $ mkdir build && cd build && cmake .. && make
...@@ -97,9 +98,6 @@ $ ./echo_client ...@@ -97,9 +98,6 @@ $ ./echo_client
Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..` Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..`
**Run tests** **Run tests**
Install gtest like just written above.
```shell ```shell
$ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make $ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make
$ cd test && sh run_tests.sh $ cd test && sh run_tests.sh
...@@ -129,6 +127,11 @@ If you need to enable cpu/heap profilers in examples: ...@@ -129,6 +127,11 @@ If you need to enable cpu/heap profilers in examples:
$ sudo yum install gperftools-devel $ sudo yum install gperftools-devel
``` ```
If you need to run tests, install and compile gtest-devel (which is not compiled yet):
```shell
$ sudo yum install gtest-devel
```
### Compile brpc with config_brpc.sh ### Compile brpc with config_brpc.sh
git clone brpc, cd into the repo and run git clone brpc, cd into the repo and run
...@@ -157,10 +160,11 @@ $ ./echo_client ...@@ -157,10 +160,11 @@ $ ./echo_client
Examples link brpc statically, if you need to link the shared version, `make clean` and `LINK_SO=1 make` Examples link brpc statically, if you need to link the shared version, `make clean` and `LINK_SO=1 make`
**Run tests** **Run tests**
```shell
Install gtest-devel. $ cd test
$ make
Rerun `config_brpc.sh`, `make` in test/, and `sh run_tests.sh` $ sh run_tests.sh
```
### Compile brpc with cmake ### Compile brpc with cmake
```shell ```shell
...@@ -185,7 +189,6 @@ $ ./echo_client ...@@ -185,7 +189,6 @@ $ ./echo_client
Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..` Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..`
**Run tests** **Run tests**
```shell ```shell
$ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make $ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make
$ cd test && sh run_tests.sh $ cd test && sh run_tests.sh
...@@ -266,7 +269,12 @@ $ brew install gflags protobuf leveldb ...@@ -266,7 +269,12 @@ $ brew install gflags protobuf leveldb
If you need to enable cpu/heap profilers in examples: If you need to enable cpu/heap profilers in examples:
```shell ```shell
$ brew install google-perftools $ brew install gperftools
```
If you need to run tests, install and compile googletest (which is not compiled yet):
```shell
$ git clone https://github.com/google/googletest && cd googletest/googletest && mkdir build && cd build && cmake .. && make && sudo mv libgtest* /usr/lib/ && cd -
``` ```
### Compile brpc with config_brpc.sh ### Compile brpc with config_brpc.sh
...@@ -293,15 +301,12 @@ $ ./echo_client ...@@ -293,15 +301,12 @@ $ ./echo_client
Examples link brpc statically, if you need to link the shared version, `make clean` and `LINK_SO=1 make` Examples link brpc statically, if you need to link the shared version, `make clean` and `LINK_SO=1 make`
**Run tests** **Run tests**
Install and compile googletest (which is not compiled yet):
```shell ```shell
$ git clone https://github.com/google/googletest && cd googletest/googletest && mkdir build && cd build && cmake .. && make && sudo mv libgtest* /usr/lib/ && cd - $ cd test
$ make
$ sh run_tests.sh
``` ```
Rerun `config_brpc.sh`, `make` in test/, and `sh run_tests.sh`
### Compile brpc with cmake ### Compile brpc with cmake
```shell ```shell
$ mkdir build && cd build && cmake .. && make $ mkdir build && cd build && cmake .. && make
...@@ -323,9 +328,6 @@ $ ./echo_client ...@@ -323,9 +328,6 @@ $ ./echo_client
Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..` Examples link brpc statically, if you need to link the shared version, use `cmake -DEXAMPLE_LINK_SO=ON ..`
**Run tests** **Run tests**
Install gtest like just written above.
```shell ```shell
$ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make $ mkdir build && cd build && cmake -DBUILD_UNIT_TESTS=ON .. && make
$ cd test && sh run_tests.sh $ cd test && sh run_tests.sh
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment