Skip to content

add trash block generator#825

Merged
pagran merged 2 commits intoburrowers:masterfrom
pagran:trash-generator
Jan 16, 2024
Merged

add trash block generator#825
pagran merged 2 commits intoburrowers:masterfrom
pagran:trash-generator

Conversation

@pagran
Copy link
Copy Markdown
Member

@pagran pagran commented Jan 2, 2024

Controversial point - a separate test file for trash generator. I did it for simplifying coverage estimation (now 92.5%), what I think is important because a lot of variations of trash code can be generated by algorithm.

Docs for users in next pullrequest

For making static code analysis even more difficult, added feature for
generating trash blocks that will never be executed. In combination
with control flow flattening makes it hard to separate trash code from
the real one, plus it causes a large number of trash references to
different methods.

Trash blocks contain 2 types of statements:
1. Function/method call with writing the results into local variables
and passing them to other calls
2. Shuffling or assigning random values to local variables
@pagran
Copy link
Copy Markdown
Member Author

pagran commented Jan 2, 2024

Trash code example (1024 stmts): https://go.godbolt.org/z/1WE9MT898 (from 52 line)

@pagran pagran requested review from luantak and mvdan January 7, 2024 15:10
@pagran pagran requested a review from luantak January 15, 2024 07:50
@pagran pagran merged commit e8fe80d into burrowers:master Jan 16, 2024
@mvdan
Copy link
Copy Markdown
Member

mvdan commented Feb 7, 2024

Docs for users in next pullrequest

@pagran did you mean to send this PR? I'm looking at doing another release, but I think this new trash block generator isn't documented yet.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants