Compiling LO for lcov/gcov code coverage fails (gb_GCOV=YES)

Maarten Hoes hoes.maarten at gmail.com
Wed May 18 14:09:45 UTC 2022


On Tue, May 17, 2022 at 10:53 AM Michael Stahl <mst at libreoffice.org> wrote:

> On 15.05.22 15:00, Maarten Hoes wrote:
> > I guess that 'git bisect run' considers things a 'success' if the build
> > succeeds (zero exit code), and a 'failure' if the build fails (non zero
> > exit code). Duh. But I don't get the impression that it matters to git
> > what it exactly was that made the build fail ?  I mean, what if there
> > were multiple build breakages between 'good commit' and 'bad commit',
> > but you are only looking for a specific failure (gcov related), and not
> > possible others that also broke the build ?
>
> maybe this can be useful:
>
>         The special exit code 125 should be used when the current source
> code cannot be tested. If the
>
>         script exits with this code, the current revision will be
> skipped (see git bisect skip above)
>
>
Although I think I don't need to do this anymore, now that the build
succeeds, I still find this useful information which I am going to take
notes of. I guess I could have written a small shellscript that gets
executed by 'git bisect run', and then not let the exitcode of the make
command be the only factor that determines if git decides if it was a
success or a failure. Instead, I could redirect the make output to a file,
and if make fails, grep in that output for something along the lines of
'undefined reference _gcov'. If that line is present in the output log, the
failure was gcov related and I exit the script with an exitcode of '1', and
else exit the script with an exitcode of '125' (build failure due to
something else). Basically, something along the lines of this (not tested) :

$ cat foo.sh
gb_GCOV=YES verbose=t make > output.log 2>&1
MAKE_RESULT="$1"

if [ "$MAKE_RESULT" = "0" ]
then
       # the build succeeded, exit 0
       exit 0
fi

if [ "$MAKE_RESULT" -ne "0" ]
then
       if grep "undefined reference _gcov" output.log >/dev/null 2>&1
       then
              # we had a match, failure due to gcov error
              exit 1
       fi
else
       # other build failure
       exit 125
fi



> > I know you can limit the
> > build to specific build targets, which would make this less likely from
> > occurring, with 'make -C external Module_foo'. But when I tried this
> > like this :
> >
> > make clean
> > ./autogen.sh --enable-python=internal --without-system-libs
> > --without-system-headers
> > verbose=t make --output-sync=target -C external Module_liborcus
> >
> > I get a build error :
> >
> > /bin/sh: line 1:
> >
> /home/maarten/src/libreoffice/core/workdir/LinkTarget/Executable/concat-deps:
>
> > No such file or directory
>
> this will build only the external module without any prerequisites in
> other modules; try instead "make liborcus.all" - this will read all
> makefile but build only what's necessary for the one module.
>

Thanks, I did not know about that one. Actually, it turns out it's
'liborcus.allbuild' now, which I found out about due to a helpful make
error message when you execute "make liborcus.all".

$ make liborcus.all
'make liborcus.all' was renamed to 'make liborcus.allcheck' (or use 'make
liborcus.allbuild' to build without unit tests)
make: *** [Makefile:122: liborcus.all] Error 42

Thanks.


- Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20220518/1138248e/attachment.htm>


More information about the LibreOffice mailing list