-
Notifications
You must be signed in to change notification settings - Fork 7
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
Feat: mutation testing integrated flows #3
base: main
Are you sure you want to change the base?
Conversation
needs initial output pushed into this branch before merging
…output-branch_name
Missing: - develop and next: stacks-node and stackslib for - master: blockstack-core and stacks-node
run: | | ||
mv git.diff ./actions-repo/mutation-testing/shell-scripts/ | ||
|
||
- uses: Swatinem/rust-cache@v2 |
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 believe we have been pinning external actions by hash to avoid possible breakage or supply chain attacks
id: git_checkout_stacks_core | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 |
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.
fetch-depth: 0
fetches entire history. Can we optimize by only fetching the branches (or commits) we are comparing?
## search in that specific folder on all 4 files | ||
## if it is matchy, remove it from that file | ||
## based on the file it was taken from, append it to the same file in the STABLE folder | ||
|
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.
It's considered good practice to add set -euo pipefail
to all bash scripts. This will cause cause failures on certain errors, rather continuing to run and producing bad results
# the append-match-package.sh | ||
## goes through each line in the output and based on the package ( first element before /) | ||
### verifies the line with the other lines in that specific folder | ||
#### in our case folder_name == package_name |
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.
Why the extra #
s?
|
||
# removes everything except .txt files | ||
|
||
#!/bin/bash |
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 needs to be the first line in the file
#!/bin/bash | ||
|
||
# moves to mutation-testing folder | ||
cd ../packages-output |
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.
Shellcheck warning:
cd ../packages-output
^-------------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
@@ -0,0 +1,41 @@ | |||
#!/bin/bash |
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 script needs some comments
impl_block="${impl_block%%\ {*}" | ||
impl_block="<impl$impl_block>" # add 'impl' word, '<' and '>' characters | ||
impl_block=$(echo "$impl_block" | sed -E 's/(^[^ ]*impl)[^ ]*/\1/') # remove everything after 'impl', until the next space | ||
impl_block=$(echo "$impl_block" | sed 's/\(<[^<]*\)[^ ]* /\1 /') # remove everything starting with '<' and ending at the next space, from the second word |
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.
Shellcheck warning:
impl_block=$(echo "$impl_block" | sed 's/\(<[^<]*\)[^ ]* /\1 /') # remove everything starting with '<' and ending at the next space, from the second word
^-- SC2001 (style): See if you can use ${variable//search/replace} instead.
shell: bash | ||
run: | | ||
if [ -f ./packages-output/last_commit_hash.txt ]; then | ||
cargo mutants --no-shuffle -j 2 -vV --in-diff ./scripts/git.diff --output temp/ |
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.
Why is the diff in the ./scripts
directory?
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.
Also, the first half of this file looks the same as filter-pr
. Why not use that?
|
||
- name: Remove deleted file lines from git.diff file | ||
shell: bash | ||
run: ./remove-deleted-file-lines.sh |
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.
Is this necessary? Shouldn't cargo mutants
be able to read a diff and know test deleted functions?
I'm not a fan of keeping the raw text output in this repo in that initial-output folder - are there alternatives you've explored for keeping this data, and more importantly keeping this data up to date? for example, some process should be periodically updating this output, correct? would a non-versioned storage location work better or is the versioning imperative for this data? |
Yes, I'll save it somewhere else and we could remove it from here afterwards. Also, as a non stable output i was thinking of the cache as it is used in the actions workflow process, but not sure what's the best stable place to keep it. ( updating a github repo, something automated ) |
for now it's fine, we should ask others for alternatives though. it just
feels wrong to keep that type of data in this specific repo
one idea is the location of the data shouldn't matter... maybe we add an
input with a download url so it's dependent on any specific service (like
s3, github etc)
…On Thu, Jan 25, 2024 at 15:11 ASuciuX ***@***.***> wrote:
Yes, I'll save it somewhere else and we could remove it from here soon.
Also, as a non stable output i was thinking of the cache as it is used in
the actions workflow process, but not sure what's the best stable place to
keep it. ( updating a github repo, something automated )
—
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVXIHE75VOK6FCFRCES643YQLRANAVCNFSM6AAAAABAPUMPJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJRGE2DENZVGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
WIP in order to merge
Description
Add 2 main new workflows for the mutation testing:
filter-pr
andlogger
. They interact with the stacks blockchain repo and keep track and filter the mutations for the PR and push actions there. They are intended to be run on master, develop and next.Logger uses 2 smaller workflows:
It also includes the scripts that are run and the last synced outputs for the master, develop and next branches of the stacks blockchain
repository.
To have mutations testing for better coverage, keeping track of untested functions and testing them as much as possible afterwards.
I've added the workflows.
They will need to have tests for the functions they are committing in the PR. If there are missing/timeout/unviable tests the CI workflow will crash. In the case that a specific function shouldn't be tested, it can be highlighted so by specifying in its header
#[mutants::skip]
or other attributes containing mutants::skip (e.g.#[cfg_attr(test, mutants::skip)]
).Mutation Testing ( splitted into 2 PRs ) stacks-core#4089
https://github.com/sourcefrog/cargo-mutants
https://mutants.rs/
Type of Change
Does this introduce a breaking change?
No
Are documentation updates required?
No. I've included readme files as well.