Subject: Re: bug#26709: Tests failing.
From: Pádraig Brady <[email-masked]>
To: Григорий Резников<[email-masked]>, [email-masked]
Date: Sat, 29 Apr 2017 20:59:24 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 29/04/17 01:37, Григорий Резников wrote:
> 
> I've tried to improve tests coverage, so I've built and ran tests using following commands:
> 
> ./configure CFLAGS="-g -fprofile-arcs -ftest-coverage"
> make -j8
> sudo make check -j8
> 
> After that I got FAIL on tests/mv/sticky-to-xpart and tests/rm/fail-2eperm.

Note there was a recently exposed race due to the extra steps to write the coverage files.
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.26-36-gc95c0a0
But your case is a permissions issue as the two root tests in question operate
as the "nobody" user by default, and thus can't rewrite the coverage files.

Note I can reproduce with `make coverage` (which uses these settings):
https://github.com/coreutils/gnulib/blob/94386a13/top/maint.mk#L1483-L1508

To avoid the issue you can use the NON_ROOT_USERNAME setting as described at:
https://github.com/coreutils/coreutils/blob/7ea15a57/README#L116-L136

So a recipe to generate coverage is:

  $ make -j8 coverage
    Overall coverage rate:
      lines......: 81.4% (43883 of 53881 lines)
      functions..: 89.5% (2335 of 2608 functions)
  $ sudo make -j8 build-coverage NON_ROOT_USERNAME=$USER SUBDIRS=.
  $ make gen-coverage
    Overall coverage rate:
      lines......: 82.5% (44476 of 53881 lines)
      functions..: 90.9% (2370 of 2608 functions)

You can view the html report with:
  xdg-open doc/coverage/index.html

I've updated the HACKING instructions as above and pushed.

cheers,
Pádraig.