Skip to content

Commit

Permalink
Update doc for function test (#1696)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Update document for function test and function test with code coverage.

### Type of change

- [x] Documentation Update
  • Loading branch information
Ami11111 authored Aug 21, 2024
1 parent 2a29610 commit e056f7b
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/getstarted/build_from_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,54 @@ pip install gcovr
```shell
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCODE_COVERAGE=ON ..
cmake --build . -t test_main
find . -name "*.gcda" | xargs rm -f
./cmake-build-debug/src/test_main
```

### Step 3 Use Gcovr to generate summarized code coverage results
```shell
cd ./cmake-build-debug/src/CMakeFiles/unit_test.dir
gcovr --gcov-executable "llvm-cov gcov" -r "YOUR_ABSOLUTE_PATH_OF_THE_PROJECT/infinity/src" --gcov-exclude-directories ${PWD}'/unit_test' . --html unit_test_html.html
```

# Build and run function test

## Build and run function test on Linux using Docker
```shell
docker exec infinity_build bash -c "cd /infinity/cmake-build-debug && cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON .. && cmake --build . -t infinity"
./cmake-build-debug/src/infinity
python3 tools/run_pytest_parallel.py
```

## Build and run function test on Ubuntu
```shell
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_VERBOSE_MAKEFILE=ON ..
cmake --build . -t infinity
./cmake-build-debug/src/infinity
python3 tools/run_pytest_parallel.py
```

## Build and run function test with code coverage
### Step 1 Build and start up Infinity server with code coverage option on
```shell
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCODE_COVERAGE=ON ..
cmake --build . -t infinity
find . -name "*.gcda" | xargs rm -f
./cmake-build-debug/src/infinity
```

### Step 2 Run function test
```shell
python3 tools/run_pytest_parallel.py
```

### Step 4 Shut down Infinity server
```shell
kill -15 `pidof infinity`
```

### Step 5 Use Gcovr to generate summarized code coverage results
```shell
cd ./cmake-build-debug/src/CMakeFiles
gcovr --gcov-executable "llvm-cov gcov" -r "YOUR_ABSOLUTE_PATH_OF_THE_PROJECT/infinity/src" --gcov-exclude-directories ${PWD}'/unit_test' . --html function_test_html.html
```

0 comments on commit e056f7b

Please sign in to comment.