Hi,

On 09/27/2017 10:18 AM, Jan Kiszka wrote:
On 2017-09-27 10:11, Claudius Heine wrote:
Hi,

On 09/27/2017 10:04 AM, Jan Kiszka wrote:
On 2017-09-27 10:00, Claudius Heine wrote:
Hi Jan,

On 09/27/2017 09:34 AM, Jan Kiszka wrote:
On 2017-09-27 09:29, Jan Kiszka wrote:
On 2017-09-26 15:22, [ext] [email protected] wrote:
From: Claudius Heine <[email protected]>

This commit adds cppcheck as a travis target. Raised issues are
suppressed and should be fixed in further commits.

Signed-off-by: Claudius Heine <[email protected]>
---
    .travis-build.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
    .travis.yml      |  1 +
    2 files changed, 44 insertions(+)

diff --git a/.travis-build.sh b/.travis-build.sh
index 56786ab..c1d16cd 100755
--- a/.travis-build.sh
+++ b/.travis-build.sh
@@ -10,6 +10,21 @@ prepare_build()
        mkdir build
        cd build
    }
+
+install_cppcheck()
+{
+    git clone https://github.com/danmar/cppcheck.git
+    cd cppcheck
+    git checkout 1.80
+    make SRCDIR=build CFGDIR=/usr/share/cppcheck HAVE_RULES=no -j2
+    sudo make install
+    # On travis cppcheck ignores CFGDIR. Instead, it looks in $PWD.
Compare
+    # strace output.
+    sudo install -m644 ./cfg/* ../
+    cd ..
+    rm -rf cppcheck
+}
+

Is anything that trusty (1.61 / 1.66) or xenial (1.72) provides in
terms
of cppcheck too old? If yes, the build should not flood the logs with
tons of warnings like it does right now (not a good sign for this
cppversion version...).

Hmm... I prefer to have a fixed version, because results of cppcheck
vary a lot between versions.

Selecting one from a specific Ubuntu release provides you exactly this.
So, unless there is need to go for 1.80, let's go for a packaged version.

Other versions of it have other messages, then I have to redo those
suppressed parameters.

I can do that, but I am not really convinced about the usefulness.


About warnings compiling cppcheck, I just
trust that the cppcheck developers know what they are doing. We cannot
see the compile errors that coverity prints out.


    case "$TARGET" in
        native)
            prepare_build
@@ -24,6 +39,34 @@ case "$TARGET" in
                host_alias=i586-linux
            exec make check
            ;;
+    cppcheck)
+        install_cppcheck
+        sup_error=""
+
sup_warn="--suppress=invalidScanfArgType_int:tools/ebgpart.c"
+        sup_info=""
+        sup_perf="--suppress=invalidscanf:tools/ebgpart.c"
+        sup_style="\
+            --suppress=unusedFunction:tools/bg_utils.c \
+            --suppress=unusedFunction:utils \
+            --suppress=unusedFunction:swupdate-adapter/ebgenv.c \
+            --suppress=unusedFunction:main.c \
+
--suppress=unusedFunction:tools/tests/test_environment.c \
+            --suppress=unusedFunction:env/fatvars.c"
+        suppress="$sup_error $sup_warn $sup_info $sup_perf
$sup_style"
+        enable="--enable=all --check-config"
+        includes="-I include \
+                  -I tools \
+                  -I swupdate-adapter \
+                  -I /usr/include \
+                  -I /usr/include/linux \
+                  -I /usr/include/efi \
+                  -I /usr/include/efi/x86_64 \
+                  -I /usr/include/x86_64-linux-gnu"
+        # Exit code '1' is returned if arguments are not valid or
if no input
+        # files are provided. Compare 'cppcheck --help'.
+        exec cppcheck -f -q --error-exitcode=2 --std=posix \
+            $enable $suppress $includes .
+        ;;
        *)
            exit -1
            ;;
diff --git a/.travis.yml b/.travis.yml
index dae0337..4fa4045 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,6 +14,7 @@ env:
      matrix:
        - TARGET=native
        - TARGET=i586
+    - TARGET=cppcheck
    language: c
      compiler:


Jan


Looking at the (presumably) relevant output of the cppcheck run,

(information) Couldn't find path given by -I 'swupdate-adapter/'
[/usr/include/libio.h:49]: (information) Include file: <stdarg.h> not
found. Please note: Cppcheck does not need standard library headers to
get proper results.
[/usr/include/stdio.h:83]: (information) Include file: <stdarg.h> not
found. Please note: Cppcheck does not need standard library headers to
get proper results.
[include/env_api.h:20]: (information) Include file: <stdbool.h> not
found. Please note: Cppcheck does not need standard library headers to
get proper results.
[/usr/include/wchar.h:39]: (information) Include file: <stdarg.h> not
found. Please note: Cppcheck does not need standard library headers to
get proper results.
[include/env_api.h:29]: (information) Include file: "config.h" not
found.

You are right with this one! Will fix this in the next version.

[/usr/include/x86_64-linux-gnu/zconf.h:427]: (information) Include
file: <stdarg.h> not found. Please note: Cppcheck does not need
standard library headers to get proper results.
[/usr/include/bits/stdio-lock.h:23]: (information) Include file:
<lowlevellock.h> not found. Please note: Cppcheck does not need
standard library headers to get proper results.
[include/ebgpart.h:43]: (information) Include file: <stdbool.h> not
found. Please note: Cppcheck does not need standard library headers to
get proper results.
[/usr/include/wchar.h:88]: (information) Skipping configuration
'_GLIBCPP_USE_NAMESPACES;__WINT_TYPE__;_WINT_T;__WINT_TYPE__' since
the value of '__WINT_TYPE__' is unknown. Use -D if you want to check
it. You can use -U to skip it explicitly.
[/usr/include/wchar.h:88]: (information) Skipping configuration
'_WINT_T;__WINT_TYPE__' since the value of '__WINT_TYPE__' is unknown.
Use -D if you want to check it. You can use -U to skip it explicitly.
[/usr/include/wchar.h:88]: (information) Skipping configuration
'__WINT_TYPE__' since the value of '__WINT_TYPE__' is unknown. Use -D
if you want to check it. You can use -U to skip it explicitly.
[tools/tests/test_api.c:14]: (information) Include file: <stdarg.h>
not found. Please note: Cppcheck does not need standard library
headers to get proper results.
[tools/tests/test_api.c:16]: (information) Include file: <stdbool.h>
not found. Please note: Cppcheck does not need standard library
headers to get proper results.
[tools/tests/test_environment.c:14]: (information) Include file:
<stdarg.h> not found. Please note: Cppcheck does not need standard
library headers to get proper results.
[tools/tests/test_environment.c:16]: (information) Include file:
<stdbool.h> not found. Please note: Cppcheck does not need standard
library headers to get proper results.
[tools/tests/test_partitions.c:14]: (information) Include file:
<stdarg.h> not found. Please note: Cppcheck does not need standard
library headers to get proper results.
[tools/tests/test_partitions.c:16]: (information) Include file:
<stdbool.h> not found. Please note: Cppcheck does not need standard
library headers to get proper results.

it seems there is still some work needed to fine tune the setting prior
to activating this.

In those other messages complains about some missing includes it does
not need, because they are part of the stl.

I can try to hide those messages.

I only look at those logs if travis writes me an email. So for me they
don't really need them to be pretty, the result is what matters.

So, I don't care about the email report because the web log seems more
complete. Anyway, both should be clean.

So hiding them is better?

Another finding: I'm not sure if we should run all variants for the
coverity scan. They seem to overwrite each other, generating multiple
reports per run. And cppcheck should definitely NOT be run for coverity
builds.

That should not be the case anyway, because this build script is only
called if coverity was not called:

      if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then ./.travis-build.sh ; fi

But you are right that coverity is called for each different environment
variable. That should be fixed. Now sure how yet.

You could pass COVERITY_SCAN_BRANCH to the script and filter on one
variant that should be built in that case.

Will do that.

Claudius

--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: [email protected]

--
You received this message because you are subscribed to the Google Groups "EFI Boot 
Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/10bf6acc-9522-25fe-aff1-fde2c65c19a1%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to