-
Notifications
You must be signed in to change notification settings - Fork 211
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
Adding a test with cppcheck for Travis CI #56
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Copyright (C) 2016 Branden Archer <[email protected]> | ||
# Copyright (C) 2016 Joshua D. Boyd <[email protected]> | ||
# Copyright (C) 2016 Nicola Spanti <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -35,6 +36,7 @@ addons: | |
apt: | ||
packages: | ||
- texinfo | ||
- cppcheck | ||
|
||
matrix: | ||
exclude: | ||
|
@@ -45,11 +47,12 @@ matrix: | |
env: USE_CMAKE=YES | ||
|
||
script: | ||
- if [ ${TRAVIS_OS_NAME} = 'linux' ]; then cppcheck --verbose --quiet --error-exitcode=1 --force --enable=performance,portability src/ tests/; fi | ||
- mkdir build | ||
- cd build | ||
- if [ $USE_CMAKE == "YES" ] ; then cmake ../ ; fi | ||
- if [ $USE_CMAKE == "NO" ] ; then pushd ../ ; autoreconf -i ; popd; fi | ||
- if [ $USE_CMAKE == "NO" ] ; then ../configure ; fi | ||
- if [ $USE_CMAKE == 'YES' ] ; then cmake .. ; fi | ||
- if [ $USE_CMAKE == 'NO' ] ; then pushd .. ; autoreconf -i ; popd; fi | ||
- if [ $USE_CMAKE == 'NO' ] ; then ../configure ; fi | ||
- make | ||
- if [ $USE_CMAKE == "YES" ] ; then CTEST_OUTPUT_ON_FAILURE=1 make test ; fi | ||
- if [ $USE_CMAKE == "NO" ] ; then make check ; fi | ||
- if [ $USE_CMAKE == 'YES' ] ; then CTEST_OUTPUT_ON_FAILURE=1 make test ; fi | ||
- if [ $USE_CMAKE == 'NO' ] ; then make check ; fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,9 +127,8 @@ static int percent_passed(TestStats * t) | |
{ | ||
if(t->n_failed == 0 && t->n_errors == 0) | ||
return 100; | ||
else if(t->n_checked == 0) | ||
if(t->n_checked == 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these style changes or logic changes? Are these because cppcheck indicated an issue? As least for cppcheck 1.74 no issues were detected in the src dir. The test dir did mention the following:
Which seems to indicate that there is a redundant null check. The following resolves this:
Would you mind including this into your pull request, to remove all errors/warnings before enabling the check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No it is very small modification, so I putted it with cppcheck. |
||
return 0; | ||
else | ||
return (int)((float)(t->n_checked - (t->n_failed + t->n_errors)) / | ||
(float)t->n_checked * 100); | ||
return (int)((float)(t->n_checked - (t->n_failed + t->n_errors)) / | ||
(float)t->n_checked * 100); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are interested in adding the LGPL header to the file, can you do so in a separate commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. #57