-
Notifications
You must be signed in to change notification settings - Fork 199
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
Refactor metaval tool-info module:extend BaseTool2 #650
Refactor metaval tool-info module:extend BaseTool2 #650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think _in_tool_directory
can also be removed?
And note that determine_result
also needs to be updated.
benchexec/tools/metaval.py
Outdated
@@ -8,14 +8,15 @@ | |||
import argparse | |||
import benchexec.util as util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import benchexec.util as util |
Unused import.
benchexec/tools/metaval.py
Outdated
wrappedOptions = self.wrappedTools[verifierName].cmdline( | ||
wrapped_executable, | ||
options, | ||
[os.path.relpath(os.path.join(os.getcwd(), "output/ARG.c"))], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually always produces ["output/ARG.c"]
because you first join it with the current directory and then make it relative to the current directory again. So this can be simplified.
But more importantly, new tool-info modules require a Task
instance here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this worked alright at the time we drafted the code (I think it was #602), what changed inbetween?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done as part of #592, i.e., the introduction of BaseTool2
. The changes to MetaVal's tool-info module were based on an intermediate draft version of that API.
If you are not yet familiar with it, I recommend having a look at our migration guide that covers the full set of differences between BaseTool
and BaseTool2
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That migration guide can be improved, it doesn't even list the method signatures. It will be quicker reading the actual code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually always produces ["output/ARG.c"] because you first join it with the current directory and then make it relative to the current directory again. So this can be simplified.
Yeah this is probably broken anyway because it actually has to be ["../output/ARG.c"], because the output folder will actually be created outside of the wrapped tool's directory. I guess this is a result of the refactoring where we replace the context manager. At that time the code probably used the cached working directory of metaval instead of os.getcwd()
. I will need to do some tool testing anyway to see whether this still works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean because you need a working BaseTool2
tool-info module to test your PR? You can do this with CPAchecker's module, it has been upgraded already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view, this and the (now 3) unused imports are the only remaining things to do. So please ping me after you finished and tested this, then I will merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that now #646 was merged, so not only CPAchecker's tool-info module but also others are now available for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4a2e3f3
to
62289b0
Compare
In practice if we wrap a tool that still extends BaseTool, we should adapt that tool to the new BaseTool2 instead of having to handle this case inside the tool-info module of MetaVal.
It is probably a bad idea anyway to have this mapping in the tool-info module. For now we just make the names generic, later we might want to move this into the tool instead.
According to @PhilippWendler
4f1313e
to
0bc3605
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to fix another unused import, but now it seems fine.
For the future: force-pushes make it harder to review on GitHub, essentially I have to reread all the code every time. For keeping the branch up-to-date, a regular merge would mean less effort for me. Furthermore, now you even copied a commit from another committer onto your branch, probably due to a wrong rebase, such that now we have that commit twice in the history. Force pushes can be a nice tool for cleaning up the history of a branch to remove small fixups etc. (but they were not used in this regard here). |
What makes you thing this could happen by a rebase? I cherry-picked that one because I needed it for testing, and forgot to remove it again when I pushed the last change.
Sure, will do next time. |
Because I have seen such things happen due to rebases. I would happen if rebasing something else onto a branch instead of the branch on something else. |
This updates the metaval tool-info module to inherit from the new
BaseTool2
base class.