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.

> 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.

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.

Jan

-- 
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/9073151f-c63e-732d-bf0b-06d86ac1b15d%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to