On 23/07/2021 11:17, Sebastian Huber wrote:
On 23/07/2021 08:52, Martin Liška wrote:

It would be nice having a test-case that can test your approach.

The problem is that you need the linker set to get access to the gcov information. The test program of the commit message works on my Linux machine. I am not sure if it is generic enough for the test suite. Instead of printing the information we could compare it against an expected output so that we have a self-contained test program.

Yep, that would be nice.

I tried to run the attached test case as "gcc/testsuite/gcc.dg/gcov-info-to-gcda.c". However, I get this error:

Invoking the compiler as /tmp/sh/b-gcc-git-linux/gcc/xgcc -B/tmp/sh/b-gcc-git-linux/gcc/ /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c  -fdiagnostics-plain-output   -fprofile-arcs -fprofile-info-section -lm  -o ./gcov-info-to-gcda.exe
Setting timeout to 300
Executing on host: /tmp/sh/b-gcc-git-linux/gcc/xgcc -B/tmp/sh/b-gcc-git-linux/gcc/ /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c  -fdiagnostics-plain-output   -fprofile-arcs -fprofile-info-section -lm  -o ./gcov-info-to-gcda.exe    (timeout = 300) spawn -ignore SIGHUP /tmp/sh/b-gcc-git-linux/gcc/xgcc -B/tmp/sh/b-gcc-git-linux/gcc/ /home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c -fdiagnostics-plain-output -fprofile-arcs -fprofile-info-section -lm -o ./gcov-info-to-gcda.exe

pid is 79704 -79704
/home/EB/sebastian_h/src/gcc/gcc/testsuite/gcc.dg/gcov-info-to-gcda.c:5:10: fatal error: gcov.h: No such file or directory

compilation terminated.


Is it possible to do such kind of tests? I also have to link to -lgcov?

Ok, the linking is not the problem. If I declare __gcov_info_to_gcda() locally, the test runs.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

Reply via email to