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

Refactor metaval tool-info module:extend BaseTool2 #650

Merged
merged 17 commits into from
Nov 21, 2020

Conversation

MartinSpiessl
Copy link
Contributor

This updates the metaval tool-info module to inherit from the new BaseTool2 base class.

@MartinSpiessl MartinSpiessl marked this pull request as draft October 28, 2020 13:17
@MartinSpiessl MartinSpiessl marked this pull request as ready for review October 28, 2020 15:01
benchexec/tools/metaval.py Outdated Show resolved Hide resolved
benchexec/tools/metaval.py Outdated Show resolved Hide resolved
Copy link
Member

@PhilippWendler PhilippWendler left a 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.

@@ -8,14 +8,15 @@
import argparse
import benchexec.util as util
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import benchexec.util as util

Unused import.

benchexec/tools/metaval.py Outdated Show resolved Hide resolved
benchexec/tools/metaval.py Outdated Show resolved Hide resolved
wrappedOptions = self.wrappedTools[verifierName].cmdline(
wrapped_executable,
options,
[os.path.relpath(os.path.join(os.getcwd(), "output/ARG.c"))],
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4f1313e should fix this by passing a proper Task object, but I have no way of knowing until #646 is merged, I manually merge that PR into this PR (with high chance that this will cause more work than it will save) or readd the BaseTool checks

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open points should be addressed via:
444a46c
e9ae4f3
8fee3ad

I also found some bugs via testing and fixed those as well:
0bc3605

Accidentally overlooked/reintroduced some unused imports, those should be fine with:
b2adf40

benchexec/tools/metaval.py Outdated Show resolved Hide resolved
benchexec/tools/metaval.py Outdated Show resolved Hide resolved
benchexec/tools/metaval.py Outdated Show resolved Hide resolved
Copy link
Member

@PhilippWendler PhilippWendler left a 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.

@PhilippWendler
Copy link
Member

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).

@PhilippWendler PhilippWendler merged commit 440339d into sosy-lab:master Nov 21, 2020
@MartinSpiessl
Copy link
Contributor Author

https://gitlab.com/sosy-lab/software/coveriteam-remote-server/-/merge_requests/6

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.

a regular merge would mean less effort for me

Sure, will do next time.

@PhilippWendler
Copy link
Member

What makes you thing this could happen by a rebase?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants