You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When auto target is chosen for project generation, it is expected that for each source file in project the exact target would be chosen. However, currently this functionality is unavailable. Instead, when auto target is selected for project then only one target would be chosen and tests for sources included into this target would be generated.
Also there exists some confusing pieces of code that should be either removed or fixed to support the auto target for project generation. Those are the following.
TargetBuildDatabase constructor in TargetBuildDatabase.cpp file. isAutoTarget flag assignment is incorrect.
Until this commit the flag assignment used to be the following.
In fact this assignment is the same as isAutoTarget = false because before line 22: isAutoTarget = target == GrpcUtils::UTBOT_AUTO_TARGET_PATHtarget is assigned as a real path to a target and this comparison always fails.
By PR fixing auto target for files and lines this line was removed and flag was set to be always false.
The bigger issue is in Linker.cpp, function linkForProject. Here we try to link the targets one by one calling linkWholeTarget function.
Moving to this function we can notice that in line 126 we change target and at the end of the function (line 158) we change the target back. However, if we take a look at setTargetPath method, we'll find out that target will be changed only once. The reason of such behavior is that when entering this function the first time, if isAutoTarget is true, then we proceed to if's body and change target path. However, for new target set flag will be false as path to a target is set manually, so calling this function for the second time will do nothing.
To conclude, I suppose this issue needs further investigation. Also tests for correct behavior should be definitely added. This can be, for example, project with multiple targets not included to one big target. In this case tests for all source files should be generated.
Environment
UTBot main at 94d79a3. Release 2022.10.4.
The text was updated successfully, but these errors were encountered:
Description
When auto target is chosen for project generation, it is expected that for each source file in project the exact target would be chosen. However, currently this functionality is unavailable. Instead, when auto target is selected for project then only one target would be chosen and tests for sources included into this target would be generated.
Also there exists some confusing pieces of code that should be either removed or fixed to support the auto target for project generation. Those are the following.
TargetBuildDatabase
constructor inTargetBuildDatabase.cpp
file.isAutoTarget
flag assignment is incorrect.Until this commit the flag assignment used to be the following.
In fact this assignment is the same as
isAutoTarget = false
because before line 22:isAutoTarget = target == GrpcUtils::UTBOT_AUTO_TARGET_PATH
target
is assigned as a real path to a target and this comparison always fails.By PR fixing auto target for files and lines this line was removed and flag was set to be always false.
The bigger issue is in
Linker.cpp
, functionlinkForProject
. Here we try to link the targets one by one callinglinkWholeTarget
function.Moving to this function we can notice that in line 126 we change target and at the end of the function (line 158) we change the target back. However, if we take a look at
setTargetPath
method, we'll find out that target will be changed only once. The reason of such behavior is that when entering this function the first time, ifisAutoTarget
is true, then we proceed to if's body and change target path. However, for new target set flag will be false as path to a target is set manually, so calling this function for the second time will do nothing.To conclude, I suppose this issue needs further investigation. Also tests for correct behavior should be definitely added. This can be, for example, project with multiple targets not included to one big target. In this case tests for all source files should be generated.
Environment
UTBot main at 94d79a3. Release 2022.10.4.
The text was updated successfully, but these errors were encountered: