Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ docker run -it -v .:/src -w /src prompp-build /bin/bash

All C++ code, along with tests, is located in the `pp` directory. Within this directory, there is a `Makefile` with the `test` target. This target will compile and run all unit tests for the C++ code.

TODO: Running a specific test.
To running test in only one package use command
```sh
make test target=//:bare_bones_test
```

It is possible also add gtest filter to run only specific tests
```sh
make test target=//:bare_bones_test filter=BareBonesVectorAllocatedMemoryFixture.ObjectWithoutAllocatedMemoryMethod
```

### Benchmarks

Expand Down
23 changes: 16 additions & 7 deletions pp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,25 @@ tidy:

.PHONY: test
test: ## Run all cpp tests
@$(bazel_test) --test_output=errors -- $(cc_tests)
ifdef target
ifdef filter
test: test_args := --test_arg=--gtest_filter=$(filter)
endif
else
test: target := $(cc_tests)
endif
test:
@$(bazel_test) $(test_args) --test_output=errors -- $(target)


.PHONY: coverage
coverage: ## Run code coverage
ifeq ($(target),)
target := //...
lcov_directory := ./bazel-testlogs/
else
lcov_directory := ./bazel-testlogs/$(target)/_coverage/bazel-out/
endif
ifeq ($(target),)
coverage: target := //...
coverage: lcov_directory := ./bazel-testlogs/
else
coverage: lcov_directory := ./bazel-testlogs/$(target)/_coverage/bazel-out/
endif
coverage:
@$(bazel) coverage $(bazel_flags) --cache_test_results=no --experimental_fetch_all_coverage_outputs $(target)
lcov -t "pp" -o pp.info -c -f -d $(lcov_directory) -b ./ --no-external \
Expand Down
Loading