Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto target does not work for project as expected #564

Open
Lana243 opened this issue Dec 14, 2022 · 0 comments
Open

Auto target does not work for project as expected #564

Lana243 opened this issue Dec 14, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Lana243
Copy link
Collaborator

Lana243 commented Dec 14, 2022

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.

  1. TargetBuildDatabase constructor in TargetBuildDatabase.cpp file. isAutoTarget flag assignment is incorrect.
    Until this commit the flag assignment used to be the following.
    image
    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.

  2. The bigger issue is in Linker.cpp, function linkForProject. Here we try to link the targets one by one calling linkWholeTarget function.
    image
    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.
    image

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.

@Lana243 Lana243 added the bug Something isn't working label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants