analyze: add scripts for computing pointwise metrics#1074
Merged
Conversation
fw-immunant
requested changes
Apr 3, 2024
Contributor
fw-immunant
left a comment
There was a problem hiding this comment.
Deduplicate the nearly-identical scripts somehow, otherwise looks good.
Comment on lines
+24
to
+26
| d="$(dirname "$f")" | ||
| f="$d/${name}_safe_${func}.rs" | ||
| cp "$d/$name.rs" "$f" |
Contributor
There was a problem hiding this comment.
These are the only difference between these two scripts--it would be good to just make these conditional and avoid the duplication.
Collaborator
Author
There was a problem hiding this comment.
I've updated this to deduplicate the similar scripts.
63ce33e to
d85b4d0
Compare
ef5fa94 to
08fb475
Compare
fw-immunant
approved these changes
Apr 29, 2024
spernsteiner
added a commit
that referenced
this pull request
Apr 29, 2024
In #1074, I had commented out a line to speed up testing, and accidentally left it that way when I merged the branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds scripts for computing "pointwise success rate" metrics. For each function, we run the static analysis and rewrite that function in isolation, producing a new
.rsfile where that function has been rewritten but all other code remains the same. Then we remove theunsafequalifier from the target function and try to compile the code. The "pointwise success rate" is the number of functions on which this procedure succeeds.The main entry point is
c2rust-analyze/scripts/run_pointwise_metrics_lighttpd.sh(as the name suggests, this is designed to compute the success rate on lighttpd specifically). It uses a few helpers:pointwise_try_build.shtries to removeunsafeand compile the rewritten code for a specific function,pointwise_try_build_unmodified.shdoes the same but on the unmodified, non-rewritten code (used for computing a baseline success rate), andpointwise_metrics.pytallies up the results and prints overall counts.Current output on lighttpd:
This PR depends on #1073, which implements the
pointwiserewrite mode inc2rust-analyze.