forked from Ericsson/codechecker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] Add new test cases for plist-to-html
- Loading branch information
1 parent
4150db3
commit f12d981
Showing
18 changed files
with
837 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ venv_dev | |
Makefile.local | ||
|
||
# tools | ||
tools/plist_to_html/build | ||
tools/tu_collector/build | ||
|
||
# external sources | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[nosetests] | ||
|
||
# increase verbosity level | ||
verbosity=3 | ||
|
||
# more detailed error messages on failed asserts | ||
detailed-errors=1 | ||
|
||
# stop running tests on first error | ||
stop=1 | ||
|
||
# do not capture stdout | ||
#nocapture=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nose==1.3.7 | ||
pycodestyle==2.4.0 | ||
pylint==1.9.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Environment variables to run tests. | ||
|
||
# Test project configuration, tests are run on these files. | ||
TEST_PROJECT ?= TEST_PROJ=$(CURRENT_DIR)/tests/projects | ||
|
||
REPO_ROOT ?= REPO_ROOT=$(ROOT) | ||
|
||
LAYOUT_DIR ?= LAYOUT_DIR=$(STATIC_DIR) | ||
|
||
# Nose test runner configuration options. | ||
NOSECFG = --config .noserc | ||
|
||
test: test_unit | ||
|
||
test_novenv: test_unit_novenv | ||
|
||
PYCODESTYLE_TEST_CMD = pycodestyle plist_to_html tests | ||
|
||
pycodestyle: venv_dev | ||
$(ACTIVATE_DEV_VENV) && $(PYCODESTYLE_TEST_CMD) | ||
|
||
PYLINT_TEST_CMD = pylint ./plist_to_html ./tests \ | ||
--disable=all \ | ||
--enable=logging-format-interpolation,old-style-class | ||
|
||
pylint: venv | ||
$(ACTIVATE_DEV_VENV) && $(PYLINT_TEST_CMD) | ||
|
||
UNIT_TEST_CMD = $(REPO_ROOT) $(TEST_PROJECT) $(LAYOUT_DIR) \ | ||
nosetests $(NOSECFG) tests/unit | ||
|
||
test_unit: venv_dev dep | ||
$(ACTIVATE_DEV_VENV) && $(UNIT_TEST_CMD) | ||
|
||
test_unit_novenv: dep | ||
$(UNIT_TEST_CMD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ----------------------------------------------------------------------------- | ||
# The CodeChecker Infrastructure | ||
# This file is distributed under the University of Illinois Open Source | ||
# License. See LICENSE.TXT for details. | ||
# ----------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# ----------------------------------------------------------------------------- | ||
# The CodeChecker Infrastructure | ||
# This file is distributed under the University of Illinois Open Source | ||
# License. See LICENSE.TXT for details. | ||
# ----------------------------------------------------------------------------- | ||
""" | ||
Test environment setup and configuration helpers. | ||
""" | ||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
from __future__ import division | ||
|
||
import os | ||
import tempfile | ||
|
||
|
||
def test_proj_root(): | ||
return os.path.abspath(os.environ['TEST_PROJ']) | ||
|
||
|
||
def get_workspace(test_id='test'): | ||
""" Return a temporary workspace for the tests. """ | ||
workspace_root = os.environ.get("PLIST_TO_HTML_TEST_WORKSPACE_ROOT") | ||
if not workspace_root: | ||
# if no external workspace is set create under the build dir | ||
workspace_root = os.path.join(os.environ['REPO_ROOT'], 'build', | ||
'workspace') | ||
|
||
if not os.path.exists(workspace_root): | ||
os.makedirs(workspace_root) | ||
|
||
if test_id: | ||
return tempfile.mkdtemp(prefix=test_id + "-", dir=workspace_root) | ||
else: | ||
return workspace_root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// ----------------------------------------------------------------------------- | ||
// The CodeChecker Infrastructure | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// ----------------------------------------------------------------------------- | ||
|
||
#define SET_PTR_VAR_TO_NULL \ | ||
ptr = 0 | ||
|
||
void nonFunctionLikeMacroTest() { | ||
int *ptr; | ||
SET_PTR_VAR_TO_NULL; | ||
*ptr = 5; // expected-warning{{Dereference of null pointer}} | ||
} |
Oops, something went wrong.