Kill lib.rs CLI escapes via function and mutator slices (#69) - #151
Merged
Conversation
5 tasks
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.
Summary
Closes #69 (child of #40).
Measures every CLI entry function in
src/lib.rsusing memory-safe, function-scoped and mutator-group batches (--workers 1,CARGO_BUILD_JOBS=1, narrow tests--test-flags "--test cli --lib"without--coverage). Kills escaped mutants via integration tests throughmessrust::runintests/cli.rs.Batch Measurement Results
Environment: Docker container capped at 2 CPUs / 4 GB RAM,
CARGO_BUILD_JOBS=1,--workers 1,--test-flags "--test cli --lib", temporary directories under$TMPDIR/mutarust-*removed after each batch.handle_info_flagsprint_usageparse_prioritysource_suffixessuffix_listsplit_listrequired_valueapply_flag_optionapply_value_optionprepare_analysisrun_analysisparse_args(all mutator groups)rundefault(Options)Escaped Mutants and Equivalence Notes
Across all CLI entry functions, 3 escaped mutants remain, and all 3 are proven behaviorally equivalent:
src/lib.rs:90inrun:return EXIT_SUCCESS;->return 0;(statement/return)Equivalence note:
EXIT_SUCCESSispub const EXIT_SUCCESS: i32 = 0;. Returning literal0produces identical behavior.src/lib.rs:95inrun:return code;->return 0;(statement/return)Equivalence note:
handle_info_flagsreturnsSome(EXIT_SUCCESS)(which is 0) on info flags (--version,--help,-h), andNoneotherwise. Whencodeis returned, its value is always0. Returning literal0produces identical behavior.src/lib.rs:72indefault:max_priority: 1->max_priority: 0;(composite/field-clear)Equivalence note: Rule priorities are integers in range 1..=5. Rules are filtered by max priority when
opts.max_priority > 0 && priority < opts.max_priority. Ifmax_priority == 1,priority < 1is false for all rules (since priority >= 1). Ifmax_priority == 0,opts.max_priority > 0is false. Both conditions filter zero rules. Behavior is identical.The fourth mutant,
max_priority: 1->max_priority: 2(numbers/incrementer), escaped previously. It is killed by the new testdefault_maximumpriority_includes_priority_one_rulesintests/cli.rs(testingcleancoderuleset containingBooleanArgumentFlagwith priority 1).Changes
tests/cli.rs: Add integration testdefault_maximumpriority_includes_priority_one_rulesthroughmessrust::run.