Skip to content

Commit

Permalink
Merge pull request Ericsson#3315 from zukatsinadze/coverage
Browse files Browse the repository at this point in the history
[githubaction] add coverage for unit tests
  • Loading branch information
csordasmarton authored May 19, 2021
2 parents b1437e6 + 4a22269 commit b79879c
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ jobs:
working-directory: analyzer
run: make test_unit test_functional

- name: Analyzer unit tests coverage
working-directory: analyzer
run: make test_unit_cov

common:
name: Common libraries
runs-on: ubuntu-18.04
Expand All @@ -129,6 +133,10 @@ jobs:
working-directory: codechecker_common/tests
run: make -C unit test_unit

- name: Run unit tests coverage
working-directory: codechecker_common/tests
run: make -C unit test_unit_cov

web:
name: Web
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -175,6 +183,10 @@ jobs:
make -C web test_matrix_${{ matrix.database }}
- name: Run unit tests coverage
working-directory: web
run: make test_unit_cov

gui:
name: GUI
runs-on: ubuntu-18.04
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,19 @@ test_unit:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) test_unit
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_COMMON)/tests/unit test_unit

test_unit_cov:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_ANALYZER) test_unit_cov
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) test_unit_cov
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_COMMON)/tests/unit test_unit_cov

test_unit_in_env:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_ANALYZER) test_unit_in_env
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) test_unit_in_env

test_unit_cov_in_env:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_ANALYZER) test_unit_cov_in_env
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) test_unit_cov_in_env

test_functional:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_ANALYZER) test_functional
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) test_functional
Expand Down
1 change: 1 addition & 0 deletions analyzer/requirements_py/dev/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pylint==2.4.4
mkdocs==1.1.2
PyYAML==5.4.1
mypy_extensions==0.4.3
coverage==5.5.0
7 changes: 7 additions & 0 deletions analyzer/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@ run_test_in_env: venv_dev
nosetests $(NOSECFG) ${TEST} || exit 1

UNIT_TEST_CMD = $(REPO_ROOT) nosetests $(NOSECFG) tests/unit
UNIT_TEST_COV_CMD = $(REPO_ROOT) coverage run -m nose $(NOSECFG) tests/unit && coverage report && coverage html

test_unit:
$(UNIT_TEST_CMD)

test_unit_cov:
$(UNIT_TEST_COV_CMD)

test_unit_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(UNIT_TEST_CMD)

test_unit_cov_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(UNIT_TEST_COV_CMD)

FUNCTIONAL_TEST_CMD = $(REPO_ROOT) $(TEST_PROJECT) \
nosetests $(NOSECFG) tests/functional || exit 1

Expand Down
1 change: 1 addition & 0 deletions codechecker_common/requirements_py/dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
nose==1.3.7
portalocker==2.2.1
coverage==5.5.0
7 changes: 7 additions & 0 deletions codechecker_common/tests/unit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ test_in_env: test_unit_in_env
test: test_unit

UNIT_TEST_CMD = $(REPO_ROOT) nosetests $(NOSECFG) .
UNIT_TEST_COV_CMD = $(REPO_ROOT) coverage run -m nose $(NOSECFG) . && coverage report && coverage html

test_unit:
$(UNIT_TEST_CMD)

test_unit_cov:
$(UNIT_TEST_COV_CMD)

test_unit_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(UNIT_TEST_CMD)

test_unit_cov_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(UNIT_TEST_COV_CMD)
8 changes: 8 additions & 0 deletions web/client/tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
CLIENT_UNIT_TEST_CMD = $(REPO_ROOT) BUILD_DIR=$(BUILD_DIR) nosetests $(NOSECFG) -w client tests/unit
CLIENT_UNIT_TEST_COV_CMD = $(REPO_ROOT) BUILD_DIR=$(BUILD_DIR) coverage run -m nose $(NOSECFG) -w client tests/unit && coverage report && coverage html


test_unit_client:
$(CLIENT_UNIT_TEST_CMD)

test_unit_cov_client:
$(CLIENT_UNIT_TEST_COV_CMD)

test_unit_client_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(CLIENT_UNIT_TEST_CMD)

test_unit_cov_client_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(CLIENT_UNIT_TEST_COV_CMD)
1 change: 1 addition & 0 deletions web/requirements_py/dev/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ nose==1.3.7
mockldap==0.3.0
mkdocs==1.1.2
mypy_extensions==0.4.3
coverage==5.5.0

./api/py/codechecker_api/dist/codechecker_api.tar.gz
./api/py/codechecker_api_shared/dist/codechecker_api_shared.tar.gz
Expand Down
7 changes: 7 additions & 0 deletions web/server/tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
SERVER_UNIT_TEST_CMD = $(REPO_ROOT) BUILD_DIR=$(BUILD_DIR) nosetests $(NOSECFG) -w server tests/unit
SERVER_UNIT_TEST_COV_CMD = $(REPO_ROOT) BUILD_DIR=$(BUILD_DIR) coverage run -m nose $(NOSECFG) -w server tests/unit && coverage report && coverage html

test_unit_server:
$(SERVER_UNIT_TEST_CMD)

test_unit_cov_server:
$(SERVER_UNIT_TEST_COV_CMD)

test_unit_server_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(SERVER_UNIT_TEST_CMD)

test_unit_cov_server_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(SERVER_UNIT_TEST_COV_CMD)
4 changes: 4 additions & 0 deletions web/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ run_test_in_env: venv_dev

test_unit: test_unit_server test_unit_client

test_unit_cov: test_unit_cov_server test_unit_cov_client

test_unit_in_env: test_unit_server_in_env test_unit_client_in_env

test_unit_cov_in_env: test_unit_cov_server_in_env test_unit_cov_client_in_env

test_functional: test_sqlite test_psql

test_functional_in_env: test_sqlite_in_env test_psql_in_env
Expand Down

0 comments on commit b79879c

Please sign in to comment.