Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add common tests to github actions and fix them #3131

Merged
merged 1 commit into from
Jan 14, 2021
Merged
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
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ jobs:
working-directory: analyzer
run: make test_unit test_functional

common:
name: Common libraries
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.6'

- name: Install requirements
working-directory: codechecker_common
run: |
pip install -r requirements_py/dev/requirements.txt
- name: Run unit tests
working-directory: codechecker_common/tests
run: make -C unit test_unit

web:
name: Web
runs-on: ubuntu-18.04
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,15 @@ pycodestyle:
pycodestyle_in_env:
$(ACTIVATE_DEV_VENV) && $(PYCODE_CMD)

test: test_analyzer test_web
test: test_common test_analyzer test_web

test_in_env: test_analyzer_in_env test_web_in_env
test_in_env: test_common_in_env test_analyzer_in_env test_web_in_env

test_common:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_COMMON)/tests/unit test_unit

test_common_in_env:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_COMMON)/tests/unit test_unit_in_env

test_analyzer:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_ANALYZER) test
Expand Down
2 changes: 2 additions & 0 deletions codechecker_common/requirements_py/dev/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nose==1.3.7
portalocker==1.7.0
18 changes: 9 additions & 9 deletions codechecker_common/tests/unit/test_gerrit_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_report_to_gerrit_conversion(self):
"""Conversion without directory path just the source filename."""

main = {
"location": {"file": "main.cpp", "line": 10, "col": 10},
"location": {"file": 0, "line": 10, "col": 10},
"description": "some description",
"check_name": "my_checker",
"issue_hash_content_of_line_in_context": "dummy_hash",
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_report_to_gerrit_conversion_abs_filepath(self):

main = {
"location": {
"file": "/home/src/lib/main.cpp",
"file": 0,
"line": 10,
"col": 10,
},
Expand All @@ -78,7 +78,7 @@ def test_report_to_gerrit_conversion_abs_filepath(self):
"macro_expansions": [],
}
bugpath = {}
files = {0: "main.cpp"}
files = {0: "/home/src/lib/main.cpp"}
metadata = {}

report_to_convert = Report(main, bugpath, files, metadata)
Expand Down Expand Up @@ -110,7 +110,7 @@ def test_report_to_gerrit_conversion_repo_dir(self):

main = {
"location": {
"file": "/home/src/lib/main.cpp",
"file": 0,
"line": 10,
"col": 10,
},
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_report_to_gerrit_conversion_report_url(self):

main = {
"location": {
"file": "/home/src/lib/main.cpp",
"file": 0,
"line": 10,
"col": 10,
},
Expand All @@ -167,7 +167,7 @@ def test_report_to_gerrit_conversion_report_url(self):
"macro_expansions": [],
}
bugpath = {}
files = {0: "main.cpp"}
files = {0: "/home/src/lib/main.cpp"}
metadata = {}

report_to_convert = Report(main, bugpath, files, metadata)
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_report_to_gerrit_conversion_filter_changed_files(self):

main = {
"location": {
"file": "/home/src/lib/main.cpp",
"file": 0,
"line": 10,
"col": 10,
},
Expand All @@ -231,7 +231,7 @@ def test_report_to_gerrit_conversion_filter_changed_files(self):

main = {
"location": {
"file": "/home/src/lib/lib.cpp",
"file": 0,
"line": 10,
"col": 10,
},
Expand All @@ -248,7 +248,7 @@ def test_report_to_gerrit_conversion_filter_changed_files(self):

main = {
"location": {
"file": "/home/src/lib/other.cpp",
"file": 0,
"line": 10,
"col": 10,
},
Expand Down