-
Couldn't load subscription status.
- Fork 30
Description
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.
-
TargetBuildDatabaseconstructor inTargetBuildDatabase.cppfile.isAutoTargetflag assignment is incorrect.
Until this commit the flag assignment used to be the following.

In fact this assignment is the same asisAutoTarget = falsebecause before line 22:isAutoTarget = target == GrpcUtils::UTBOT_AUTO_TARGET_PATHtargetis 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 callinglinkWholeTargetfunction.

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 atsetTargetPathmethod, 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, ifisAutoTargetis 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status