ramarromarrone
01-07-2008, 22:18
ciao a tutti
sto facendo un progetto diviso in sette file:
definizioni.h strutture.h funzioni.h algoritmi.h funzioni.c algoritmi.c test_unitari.c
devo testare la copertura dei test unitari realizzati con CUnit con gcov
quindi compilo con il seguente comando:
gcc -fprofile-arcs -ftest-coverage -lcunit -o test funzioni.c algoritmi.c test_unitari.c
poi
gcov -b test_unitari.c
mi dice:
test_unitari.gcda:cannot open data file, assuming not executed
File 'test_unitari.c'
Lines executed:0.00% of 715
Branches executed:0.00% of 68
Taken at least once:0.00% of 68
Calls executed:0.00% of 565
test_unitari.c:creating 'test_unitari.c.gcov'
insomma...in parole povere come si usa gcov???
e poi ho un altro problema:
se compilo con
gcc -lcunit -o test funzioni.c algoritmi.c test_unitari.c
ed eseguo ./test
tutti i test passano senza nessun problema...
se invece faccio
gcc -fprofile-arcs -ftest-coverage -lcunit -o test funzioni.c algoritmi.c test_unitari.c
ed eseguo ./test i test passano tutti ma alla fine
mi da questo errore:
*** glibc detected *** ./test: double free or corruption (out): 0x08165ae8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e7ea85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7e824f0]
/lib/tls/i686/cmov/libc.so.6(fclose+0x134)[0xb7e6d3e4]
./test[0x8056c3e]
./test[0x80574f2]
/lib/tls/i686/cmov/libc.so.6(exit+0xd4)[0xb7e41084]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe8)[0xb7e29458]
./test[0x8048e01]
======= Memory map: ========
08048000-0805a000 r-xp 00000000 08:01 411430 /home/andrea/tesi4/test
0805a000-0805b000 rw-p 00012000 08:01 411430 /home/andrea/tesi4/test
0805b000-08186000 rw-p 0805b000 00:00 0 [heap]
b7d00000-b7d21000 rw-p b7d00000 00:00 0
b7d21000-b7e00000 ---p b7d21000 00:00 0
b7e07000-b7e11000 r-xp 00000000 08:01 229862 /lib/libgcc_s.so.1
b7e11000-b7e12000 rw-p 0000a000 08:01 229862 /lib/libgcc_s.so.1
b7e12000-b7e13000 rw-p b7e12000 00:00 0
b7e13000-b7f5c000 r-xp 00000000 08:01 263740 /lib/tls/i686/cmov/libc-2.7.so
b7f5c000-b7f5d000 r--p 00149000 08:01 263740 /lib/tls/i686/cmov/libc-2.7.so
b7f5d000-b7f5f000 rw-p 0014a000 08:01 263740 /lib/tls/i686/cmov/libc-2.7.so
b7f5f000-b7f62000 rw-p b7f5f000 00:00 0
b7f62000-b7f6a000 r-xp 00000000 08:01 1592440 /usr/lib/libcunit.so.1.0.1
b7f6a000-b7f6d000 rw-p 00007000 08:01 1592440 /usr/lib/libcunit.so.1.0.1
b7f7e000-b7f80000 rw-p b7f7e000 00:00 0
b7f80000-b7f81000 r-xp b7f80000 00:00 0 [vdso]
b7f81000-b7f9b000 r-xp 00000000 08:01 230035 /lib/ld-2.7.so
b7f9b000-b7f9d000 rw-p 00019000 08:01 230035 /lib/ld-2.7.so
bff3e000-bff5c000 rw-p bffe2000 00:00 0 [stack]
Aborted
come mai?
sto facendo un progetto diviso in sette file:
definizioni.h strutture.h funzioni.h algoritmi.h funzioni.c algoritmi.c test_unitari.c
devo testare la copertura dei test unitari realizzati con CUnit con gcov
quindi compilo con il seguente comando:
gcc -fprofile-arcs -ftest-coverage -lcunit -o test funzioni.c algoritmi.c test_unitari.c
poi
gcov -b test_unitari.c
mi dice:
test_unitari.gcda:cannot open data file, assuming not executed
File 'test_unitari.c'
Lines executed:0.00% of 715
Branches executed:0.00% of 68
Taken at least once:0.00% of 68
Calls executed:0.00% of 565
test_unitari.c:creating 'test_unitari.c.gcov'
insomma...in parole povere come si usa gcov???
e poi ho un altro problema:
se compilo con
gcc -lcunit -o test funzioni.c algoritmi.c test_unitari.c
ed eseguo ./test
tutti i test passano senza nessun problema...
se invece faccio
gcc -fprofile-arcs -ftest-coverage -lcunit -o test funzioni.c algoritmi.c test_unitari.c
ed eseguo ./test i test passano tutti ma alla fine
mi da questo errore:
*** glibc detected *** ./test: double free or corruption (out): 0x08165ae8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7e7ea85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7e824f0]
/lib/tls/i686/cmov/libc.so.6(fclose+0x134)[0xb7e6d3e4]
./test[0x8056c3e]
./test[0x80574f2]
/lib/tls/i686/cmov/libc.so.6(exit+0xd4)[0xb7e41084]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe8)[0xb7e29458]
./test[0x8048e01]
======= Memory map: ========
08048000-0805a000 r-xp 00000000 08:01 411430 /home/andrea/tesi4/test
0805a000-0805b000 rw-p 00012000 08:01 411430 /home/andrea/tesi4/test
0805b000-08186000 rw-p 0805b000 00:00 0 [heap]
b7d00000-b7d21000 rw-p b7d00000 00:00 0
b7d21000-b7e00000 ---p b7d21000 00:00 0
b7e07000-b7e11000 r-xp 00000000 08:01 229862 /lib/libgcc_s.so.1
b7e11000-b7e12000 rw-p 0000a000 08:01 229862 /lib/libgcc_s.so.1
b7e12000-b7e13000 rw-p b7e12000 00:00 0
b7e13000-b7f5c000 r-xp 00000000 08:01 263740 /lib/tls/i686/cmov/libc-2.7.so
b7f5c000-b7f5d000 r--p 00149000 08:01 263740 /lib/tls/i686/cmov/libc-2.7.so
b7f5d000-b7f5f000 rw-p 0014a000 08:01 263740 /lib/tls/i686/cmov/libc-2.7.so
b7f5f000-b7f62000 rw-p b7f5f000 00:00 0
b7f62000-b7f6a000 r-xp 00000000 08:01 1592440 /usr/lib/libcunit.so.1.0.1
b7f6a000-b7f6d000 rw-p 00007000 08:01 1592440 /usr/lib/libcunit.so.1.0.1
b7f7e000-b7f80000 rw-p b7f7e000 00:00 0
b7f80000-b7f81000 r-xp b7f80000 00:00 0 [vdso]
b7f81000-b7f9b000 r-xp 00000000 08:01 230035 /lib/ld-2.7.so
b7f9b000-b7f9d000 rw-p 00019000 08:01 230035 /lib/ld-2.7.so
bff3e000-bff5c000 rw-p bffe2000 00:00 0 [stack]
Aborted
come mai?