Discussion:
make coverage
(too old to reply)
Tim Rühsen
2017-05-17 14:39:19 UTC
Permalink
Raw Message
Hi,

'make coverage' fails here due to two tests failing, thus no coverage
report is created.


Here is a patch to fix this by skipping those tests.

I couldn't find a better solution.

There still is

Processing file gllib/gllib/unicase/special-casing-table.gperf
genhtml: ERROR: cannot read
/usr/oms/src/testdir1/gllib/gllib/unicase/special-casing-table.gperf
maint.mk:1500: recipe for target 'gen-coverage' failed

(Maybe this is because I still use gperf 3.0.4 !?)

Fixable with

$ lcov --remove doc/coverage/dummy.info '*gllib/gllib/*' -o
doc/coverage/dummy.info

$ make gen-coverage

With Best Regards, Tim
Bruno Haible
2017-05-17 16:40:41 UTC
Permalink
Raw Message
Hi Tim,
Post by Tim Rühsen
'make coverage' fails here due to two tests failing, thus no coverage
report is created.
I couldn't find a better solution.
In the comment, you write "possible crash when compiled with -coverage".
Our tests should not crash, with or without --coverage, on glibc systems.

IMO we should try to make these tests not crash.

What is the list of steps for "How to reproduce"?
Post by Tim Rühsen
There still is
Processing file gllib/gllib/unicase/special-casing-table.gperf
genhtml: ERROR: cannot read
/usr/oms/src/testdir1/gllib/gllib/unicase/special-casing-table.gperf
maint.mk:1500: recipe for target 'gen-coverage' failed
(Maybe this is because I still use gperf 3.0.4 !?)
Possibly. See this thread:
https://lists.gnu.org/archive/html/bug-gnulib/2017-02/msg00044.html

Bruno
Tim Rühsen
2017-05-18 09:26:40 UTC
Permalink
Raw Message
Post by Bruno Haible
Hi Tim,
Post by Tim Rühsen
'make coverage' fails here due to two tests failing, thus no coverage
report is created.
I couldn't find a better solution.
In the comment, you write "possible crash when compiled with -coverage".
Our tests should not crash, with or without --coverage, on glibc systems.
IMO we should try to make these tests not crash.
What is the list of steps for "How to reproduce"?
$ ./gnulib-tool --create-testdir --dir=../testdir1
$ cd ../testdir
$ ./configure CFLAGS="-g -coverage"
$ make clean && make coverage

In file included from unicase/special-casing.c:25:0:
./unicase/special-casing-table.h:63:1: error: conflicting types for
'gl_unicase_special_lookup'
gl_unicase_special_lookup (register const char *str, register unsigned
int len)
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from unicase/special-casing.c:21:0:
unicase/special-casing.h:61:8: note: previous declaration of
'gl_unicase_special_lookup' was here
gl_unicase_special_lookup (const char *str, size_t len);
^~~~~~~~~~~~~~~~~~~~~~~~~

$ vi gllib/unicase/special-casing-table.h # change 'len' to size_t in L63
$ make coverage
...
# FAIL: 9

7 failures are due to using system libunistring (Version
0.9.6+really0.9.3-0.1) and can be avoided by ./configure
--with-included-libunistring.

The other 2 are
FAIL: test-printf-posix2.sh
FAIL: test-fprintf-posix2.sh

$ cat gltests/test-printf-posix2.sh.log
Segmentation fault
FAIL test-printf-posix2.sh (exit status: 1)

$ valgrind gltests/./test-printf-posix2 0
...
==2265== Cannot map memory to grow the stack for thread #1 to 0xffeffb000
==2265==
==2265== Process terminating with default action of signal 11 (SIGSEGV)
==2265== Access not within mapped region at address 0xFFEFFB43C
==2265== Cannot map memory to grow the stack for thread #1 to 0xffeffb000
==2265== at 0x10A296: gcov_do_dump (in
/usr/oms/src/testdir1/gltests/test-printf-posix2)
...
Segmentation fault


I can not reproduce this when starting with
$ ./gnulib-tool --create-testdir --dir=../testdir1 --single-configure
printf-posix printf-posix-tests maintainer-makefile


With Best Regards, Tim
Bruno Haible
2017-05-18 17:29:18 UTC
Permalink
Raw Message
Post by Tim Rühsen
$ ./gnulib-tool --create-testdir --dir=../testdir1
$ cd ../testdir
$ ./configure CFLAGS="-g -coverage"
$ make clean && make coverage
I did
$ ./gnulib-tool --create-testdir --dir=../testdir-all
$ cd ../testdir-all
$ ./configure CFLAGS="-ggdb --coverage"
$ make coverage

and these tests pass:

PASS: test-fprintf-posix.sh
PASS: test-fprintf-posix2.sh
PASS: test-fprintf-posix3.sh
...
PASS: test-printf-posix.sh
PASS: test-printf-posix2.sh

This is on Ubuntu 16.04, with
$ ulimit -s
8192
Post by Tim Rühsen
7 failures are due to using system libunistring (Version
0.9.6+really0.9.3-0.1) and can be avoided by ./configure
--with-included-libunistring.
Ugh. Looks like your distributor plays weird games with the libunistring shared
library version.
https://launchpad.net/debian/+source/libunistring/0.9.6+really0.9.3-0.1
This happens if a distributor gives a higher .so version to a shared library
than it really is.
Post by Tim Rühsen
The other 2 are
FAIL: test-printf-posix2.sh
FAIL: test-fprintf-posix2.sh
$ cat gltests/test-printf-posix2.sh.log
Segmentation fault
FAIL test-printf-posix2.sh (exit status: 1)
I get
$ cat gltests/test-printf-posix2.sh.log
PASS test-printf-posix2.sh (exit status: 0)
Post by Tim Rühsen
$ valgrind gltests/./test-printf-posix2 0
...
==2265== Cannot map memory to grow the stack for thread #1 to 0xffeffb000
==2265==
==2265== Process terminating with default action of signal 11 (SIGSEGV)
==2265== Access not within mapped region at address 0xFFEFFB43C
==2265== Cannot map memory to grow the stack for thread #1 to 0xffeffb000
==2265== at 0x10A296: gcov_do_dump (in /usr/oms/src/testdir1/gltests/test-printf-posix2)
...
Segmentation fault
I get the same thing under valgrind.
$ valgrind gltests/test-printf-posix2 0
==24958== Memcheck, a memory error detector
==24958== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==24958== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==24958== Command: gltests/test-printf-posix2 0
==24958==
==24958== Cannot map memory to grow the stack for thread #1 to 0xffeffa000
==24958==
==24958== Process terminating with default action of signal 11 (SIGSEGV)
==24958== Access not within mapped region at address 0xFFEFFAFF4
==24958== Cannot map memory to grow the stack for thread #1 to 0xffeffa000
==24958== at 0x4020F6: gcov_do_dump (in /media/develdata/devel/GNULIB/testdir-all/gltests/test-printf-posix2)
==24958== If you believe this happened as a result of a stack
==24958== overflow in your program's main thread (unlikely but
==24958== possible), you can try to increase the size of the
==24958== main thread stack using the --main-stacksize= flag.
==24958== The main thread stack size used in this run was 5000000.
==24958== Cannot map memory to grow the stack for thread #1 to 0xffeffa000
==24958==
==24958== Process terminating with default action of signal 11 (SIGSEGV)
==24958== Access not within mapped region at address 0xFFEFFAF88
==24958== Cannot map memory to grow the stack for thread #1 to 0xffeffa000
==24958== at 0x4A28680: _vgnU_freeres (in /usr/lib/valgrind/vgpreload_core-amd64-linux.so)
==24958== If you believe this happened as a result of a stack
==24958== overflow in your program's main thread (unlikely but
==24958== possible), you can try to increase the size of the
==24958== main thread stack using the --main-stacksize= flag.
==24958== The main thread stack size used in this run was 5000000.
==24958==
==24958== HEAP SUMMARY:
==24958== in use at exit: 0 bytes in 0 blocks
==24958== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==24958==
==24958== All heap blocks were freed -- no leaks are possible
==24958==
==24958== For counts of detected and suppressed errors, rerun with: -v
==24958== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Speicherzugriffsfehler (Speicherabzug geschrieben)

but I don't want to debug valgrind here.

What do you get if you change the value 5000000 in tests/test-fprintf-posix2.c
to a larger or smaller value?

Bruno
Tim Rühsen
2017-05-18 19:15:37 UTC
Permalink
Raw Message
Post by Bruno Haible
Post by Tim Rühsen
$ ./gnulib-tool --create-testdir --dir=../testdir1
$ cd ../testdir
$ ./configure CFLAGS="-g -coverage"
$ make clean && make coverage
I did
$ ./gnulib-tool --create-testdir --dir=../testdir-all
$ cd ../testdir-all
$ ./configure CFLAGS="-ggdb --coverage"
$ make coverage
PASS: test-fprintf-posix.sh
PASS: test-fprintf-posix2.sh
PASS: test-fprintf-posix3.sh
...
PASS: test-printf-posix.sh
PASS: test-printf-posix2.sh
I am on a different hardware, but same OS (Debian unstable) now,
same tests fail as before.
Post by Bruno Haible
This is on Ubuntu 16.04, with
$ ulimit -s
8192
ulimit -s is the same here.
Post by Bruno Haible
Post by Tim Rühsen
7 failures are due to using system libunistring (Version
0.9.6+really0.9.3-0.1) and can be avoided by ./configure
--with-included-libunistring.
Ugh. Looks like your distributor plays weird games with the libunistring
shared library version.
https://launchpad.net/debian/+source/libunistring/0.9.6+really0.9.3-0.1
This happens if a distributor gives a higher .so version to a shared library
than it really is.
Yes, this is ugly. Gave us some headaches at the libidn2 project.
Debian has a bug report pending from me and will likely fix it when freeze is
over.
Post by Bruno Haible
What do you get if you change the value 5000000 in
tests/test-fprintf-posix2.c to a larger or smaller value?
No change with 500000 (10x smaller).
Both succeed with 50000000 (10x higher).

With Best Regards, Tim
Bruno Haible
2017-05-18 20:15:46 UTC
Permalink
Raw Message
Hi Tim,
Post by Tim Rühsen
Post by Bruno Haible
What do you get if you change the value 5000000 in
tests/test-fprintf-posix2.c to a larger or smaller value?
Both succeed with 50000000 (10x higher).
Good, that's the way I'd like to see it fixed. But a malloc(50 MB)
is extraordinary; some people are using embedded systems. Can you please
see which is the smallest among the following values which make the tests
succeed?
10000000
15000000
20000000
25000000

Thanks.

Bruno
Tim Rühsen
2017-05-19 07:31:25 UTC
Permalink
Raw Message
Post by Bruno Haible
Hi Tim,
Post by Tim Rühsen
Post by Bruno Haible
What do you get if you change the value 5000000 in
tests/test-fprintf-posix2.c to a larger or smaller value?
Both succeed with 50000000 (10x higher).
Good, that's the way I'd like to see it fixed. But a malloc(50 MB)
is extraordinary; some people are using embedded systems. Can you please
see which is the smallest among the following values which make the tests
succeed?
10000000
15000000
20000000
25000000
10000000 works here.


With Best Regards, Tim
Post by Bruno Haible
Thanks.
Bruno
Bruno Haible
2017-05-19 17:29:55 UTC
Permalink
Raw Message
Post by Tim Rühsen
10000000 works here.
Thanks for the testing. I'm applying this workaround:


2017-05-19 Bruno Haible <***@clisp.org>

printf-posix tests: Avoid test failure with "gcc --coverage".
Reported by Tim Rühsen <***@gmx.de>.
* tests/test-printf-posix2.c (main): Test a width of 10000000 rather
than 5000000.
* tests/test-fprintf-posix2.c (main): Likewise.

diff --git a/tests/test-fprintf-posix2.c b/tests/test-fprintf-posix2.c
index 4687b93..c6850a2 100644
--- a/tests/test-fprintf-posix2.c
+++ b/tests/test-fprintf-posix2.c
@@ -41,8 +41,8 @@ main (int argc, char *argv[])
#ifdef RLIMIT_DATA
if (getrlimit (RLIMIT_DATA, &limit) < 0)
return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
+ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 10000000)
+ limit.rlim_max = 10000000;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_DATA, &limit) < 0)
return 77;
@@ -51,8 +51,8 @@ main (int argc, char *argv[])
#ifdef RLIMIT_AS
if (getrlimit (RLIMIT_AS, &limit) < 0)
return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
+ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 10000000)
+ limit.rlim_max = 10000000;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_AS, &limit) < 0)
return 77;
@@ -61,8 +61,8 @@ main (int argc, char *argv[])
#ifdef RLIMIT_STACK
if (getrlimit (RLIMIT_STACK, &limit) < 0)
return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
+ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 10000000)
+ limit.rlim_max = 10000000;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_STACK, &limit) < 0)
return 77;
@@ -73,30 +73,30 @@ main (int argc, char *argv[])
{
case 0:
{
- void *memory = malloc (5000000);
+ void *memory = malloc (10000000);
if (memory == NULL)
return 1;
- memset (memory, 17, 5000000);
+ memset (memory, 17, 10000000);
return 78;
}
case 1:
- ret = fprintf (stdout, "%.5000000f", 1.0);
- return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
+ ret = fprintf (stdout, "%.10000000f", 1.0);
+ return !(ret == 10000002 || (ret < 0 && errno == ENOMEM));
case 2:
- ret = fprintf (stdout, "%.5000000f", -1.0);
- return !(ret == 5000003 || (ret < 0 && errno == ENOMEM));
+ ret = fprintf (stdout, "%.10000000f", -1.0);
+ return !(ret == 10000003 || (ret < 0 && errno == ENOMEM));
case 3:
- ret = fprintf (stdout, "%.5000000e", 1.0);
- return !(ret >= 5000006 || (ret < 0 && errno == ENOMEM));
+ ret = fprintf (stdout, "%.10000000e", 1.0);
+ return !(ret >= 10000006 || (ret < 0 && errno == ENOMEM));
case 4:
- ret = fprintf (stdout, "%.5000000d", 1);
- return !(ret == 5000000 || (ret < 0 && errno == ENOMEM));
+ ret = fprintf (stdout, "%.10000000d", 1);
+ return !(ret == 10000000 || (ret < 0 && errno == ENOMEM));
case 5:
- ret = fprintf (stdout, "%.5000000d", -1);
- return !(ret == 5000001 || (ret < 0 && errno == ENOMEM));
+ ret = fprintf (stdout, "%.10000000d", -1);
+ return !(ret == 10000001 || (ret < 0 && errno == ENOMEM));
case 6:
- ret = fprintf (stdout, "%.5000000u", 1);
- return !(ret == 5000000 || (ret < 0 && errno == ENOMEM));
+ ret = fprintf (stdout, "%.10000000u", 1);
+ return !(ret == 10000000 || (ret < 0 && errno == ENOMEM));
}
return 0;
}
diff --git a/tests/test-printf-posix2.c b/tests/test-printf-posix2.c
index b6ad209..531420c 100644
--- a/tests/test-printf-posix2.c
+++ b/tests/test-printf-posix2.c
@@ -41,8 +41,8 @@ main (int argc, char *argv[])
#ifdef RLIMIT_DATA
if (getrlimit (RLIMIT_DATA, &limit) < 0)
return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
+ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 10000000)
+ limit.rlim_max = 10000000;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_DATA, &limit) < 0)
return 77;
@@ -51,8 +51,8 @@ main (int argc, char *argv[])
#ifdef RLIMIT_AS
if (getrlimit (RLIMIT_AS, &limit) < 0)
return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
+ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 10000000)
+ limit.rlim_max = 10000000;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_AS, &limit) < 0)
return 77;
@@ -61,8 +61,8 @@ main (int argc, char *argv[])
#ifdef RLIMIT_STACK
if (getrlimit (RLIMIT_STACK, &limit) < 0)
return 77;
- if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
- limit.rlim_max = 5000000;
+ if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 10000000)
+ limit.rlim_max = 10000000;
limit.rlim_cur = limit.rlim_max;
if (setrlimit (RLIMIT_STACK, &limit) < 0)
return 77;
@@ -73,30 +73,30 @@ main (int argc, char *argv[])
{
case 0:
{
- void *memory = malloc (5000000);
+ void *memory = malloc (10000000);
if (memory == NULL)
return 1;
- memset (memory, 17, 5000000);
+ memset (memory, 17, 10000000);
return 78;
}
case 1:
- ret = printf ("%.5000000f", 1.0);
- return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
+ ret = printf ("%.10000000f", 1.0);
+ return !(ret == 10000002 || (ret < 0 && errno == ENOMEM));
case 2:
- ret = printf ("%.5000000f", -1.0);
- return !(ret == 5000003 || (ret < 0 && errno == ENOMEM));
+ ret = printf ("%.10000000f", -1.0);
+ return !(ret == 10000003 || (ret < 0 && errno == ENOMEM));
case 3:
- ret = printf ("%.5000000e", 1.0);
- return !(ret >= 5000006 || (ret < 0 && errno == ENOMEM));
+ ret = printf ("%.10000000e", 1.0);
+ return !(ret >= 10000006 || (ret < 0 && errno == ENOMEM));
case 4:
- ret = printf ("%.5000000d", 1);
- return !(ret == 5000000 || (ret < 0 && errno == ENOMEM));
+ ret = printf ("%.10000000d", 1);
+ return !(ret == 10000000 || (ret < 0 && errno == ENOMEM));
case 5:
- ret = printf ("%.5000000d", -1);
- return !(ret == 5000001 || (ret < 0 && errno == ENOMEM));
+ ret = printf ("%.10000000d", -1);
+ return !(ret == 10000001 || (ret < 0 && errno == ENOMEM));
case 6:
- ret = printf ("%.5000000u", 1);
- return !(ret == 5000000 || (ret < 0 && errno == ENOMEM));
+ ret = printf ("%.10000000u", 1);
+ return !(ret == 10000000 || (ret < 0 && errno == ENOMEM));
}
return 0;
}

Tim Rühsen
2017-05-18 09:15:05 UTC
Permalink
Raw Message
Bruno Haible
2017-05-18 11:00:29 UTC
Permalink
Raw Message
Hi Tim,
Post by Tim Rühsen
Processing file gllib/gllib/unicase/special-casing-table.gperf
genhtml: ERROR: cannot read
/usr/oms/src/testdir1/gllib/gllib/unicase/special-casing-table.gperf
maint.mk:1500: recipe for target 'gen-coverage' failed
(Maybe this is because I still use gperf 3.0.4 !?)
The gperf-3.0.4 incompatibility is now fixed. Can you please retry?

Bruno
Tim Rühsen
2017-05-18 12:36:36 UTC
Permalink
Raw Message
Post by Bruno Haible
Hi Tim,
Post by Tim Rühsen
Processing file gllib/gllib/unicase/special-casing-table.gperf
genhtml: ERROR: cannot read
/usr/oms/src/testdir1/gllib/gllib/unicase/special-casing-table.gperf
maint.mk:1500: recipe for target 'gen-coverage' failed
(Maybe this is because I still use gperf 3.0.4 !?)
The gperf-3.0.4 incompatibility is now fixed. Can you please retry?
Yes thanks, that works for me now (re-done everything from scratch).
Post by Bruno Haible
Bruno
With Best Regards, Tim
Loading...