Post by budzikm on Aug 22, 2015 7:16:30 GMT -5
Hi!
Ive encountered problem whilst trying to get code coverage.
I compile using Cygwin+i686-pc-mingw-w64 as follows:
testape -mgw gcc -I./src --coverage ./src/Psm.c testmain.c testape.a
./a.exe
gcov -a ./src/Psm.c
I successfully get coverage result for tests if no mocks are generated, but...
...when I want to unit-test Psm_Task in Psm.c file(part of it) below and I have mock for functions Cdb* generated, problems appear:
Console result:
/cygdrive/c/(...)/ccAPd2WJ.o:testmain.c(.text+0x73): undefined reference to 'Cdb_Get_Psm_VolPwrrf$$tah'
/cygdrive/c/(...)/ccAPd2WJ.o:testmain.c(.text+0x73): undefined reference to 'Cdb_Get_Psm_IgnDiagThVolts$$tah'
(..) bad reloc address 0x0 in section '.data'
if I remove --coverage option, compilations goes OK.
I found that in testape.h some macro adds $$tah to function's name, if I remove it, compilation passes, but framework seems to work weird
Is there some solution to this problem ? Compiling with -ftest-coverage option only does not work because no .gcda file is genereated then...
Thank you for your help in advance!
Ps. testmain:
Ive encountered problem whilst trying to get code coverage.
I compile using Cygwin+i686-pc-mingw-w64 as follows:
testape -mgw gcc -I./src --coverage ./src/Psm.c testmain.c testape.a
./a.exe
gcov -a ./src/Psm.c
I successfully get coverage result for tests if no mocks are generated, but...
...when I want to unit-test Psm_Task in Psm.c file(part of it) below and I have mock for functions Cdb* generated, problems appear:
void Psm_Task(void)
{
switch(diag_state)
{
case PSM_DIAG_STATE_INACTIVE:
{
if(Cdb_Get_Psm_VolPwrrf() > Cdb_Get_Psm_IgnDiagThVolts())
{
loop_v_pwrrf_2v8_cnt++;
if(loop_v_pwrrf_2v8_cnt >= Cdb_Get_Psm_IgmDiagThTime())
{
loop_v_pwrrf_2v8_cnt = 0;
diag_state = PSM_DIAG_STATE_ACTIVE;
}
}
else
{
loop_v_pwrrf_2v8_cnt = 0;
}
Console result:
/cygdrive/c/(...)/ccAPd2WJ.o:testmain.c(.text+0x73): undefined reference to 'Cdb_Get_Psm_VolPwrrf$$tah'
/cygdrive/c/(...)/ccAPd2WJ.o:testmain.c(.text+0x73): undefined reference to 'Cdb_Get_Psm_IgnDiagThVolts$$tah'
(..) bad reloc address 0x0 in section '.data'
if I remove --coverage option, compilations goes OK.
I found that in testape.h some macro adds $$tah to function's name, if I remove it, compilation passes, but framework seems to work weird
Is there some solution to this problem ? Compiling with -ftest-coverage option only does not work because no .gcda file is genereated then...
Thank you for your help in advance!
Ps. testmain:
#include "testape.h"
#include "Psm.h"
#include <stdio.h>
char* build_info = "PSM MODULE";
void chs_test_1(void)
{
EXPECT(Cdb_Get_Psm_VolPwrrf);
EXPECT(Cdb_Get_Psm_IgnDiagThVolts);
Psm_Task();
}
void testmain(void)
{
EXECUTE(chs_test_1);
}
void testape_error_handler(void) {
}
double testape_validate_fp_accuracy() {
return 0.1f;
}
char* testape_build_info() {
return build_info;
}