-
Notifications
You must be signed in to change notification settings - Fork 17
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
[WIP] Upgrade Pitest to 1.15.8 #224
base: master
Are you sure you want to change the base?
Conversation
@echebbi I created #226 and build is green. Please have a look and merge it if you're OK with that. I tried to cherry pick some of your commits but of you course you should expect merging conflicts. I wonder if some of the failures I see in your builds (unbound Java 1.8 classpath container) might be due to Java 21 not supporting Java 8 anymore. In any case, I think the main build should be with Java 17 and we could have another build testing that, at least the runtime tests are green. |
72d2f15
to
bcd0943
Compare
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.
bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/Mutators.java
Outdated
Show resolved
Hide resolved
bundles/org.pitest.pitclipse.core/src/org/pitest/pitclipse/core/Mutators.java
Outdated
Show resolved
Hide resolved
...rg.pitest.pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/ClassSummary.java
Outdated
Show resolved
Hide resolved
....pitclipse.runner/src/org/pitest/pitclipse/runner/results/summary/SummaryResultListener.java
Outdated
Show resolved
Hide resolved
...t.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/DurationElapsed.java
Outdated
Show resolved
Hide resolved
....ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitMutationsViewPageObject.java
Outdated
Show resolved
Hide resolved
....ui.tests/src/org/pitest/pitclipse/ui/behaviours/pageobjects/PitMutationsViewPageObject.java
Outdated
Show resolved
Hide resolved
...test.pitclipse.ui.tests/src/org/pitest/pitclipse/ui/tests/PitclipseMultipleProjectsTest.java
Outdated
Show resolved
Hide resolved
@@ -162,94 +144,31 @@ public void checkAllMutants() { // NOSONAR | |||
PAGES.getRunMenu().checkAllMutators(TEST_CONFIG_NAME); | |||
// run test and confirm result is as expected | |||
PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME); | |||
coverageReportGenerated(TESTED_CLASSES, COVERAGE, 1, 84, 1); | |||
coverageReportGenerated(TESTED_CLASSES, COVERAGE, 5, 20, 1); |
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.
We lose all these mutators because of the mutators removed by default in PIT?
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.
Looks like it, yes. We did lose a lot of mutations operators (see Mutations.java, MutatorApiOfPitTest.java and the list of research mutators). That being said I believe we should take some time to make sure I didn't miss something while upgrading.
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.
@echebbi So creating a new bundle for https://github.com/pitest/pitest-rv-plugin and adding it to our distribution would bring the old mutators back?
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.
Yes, just like we did for the pitest-junit5
plugin. Do you think that we should integrate the pitest-rv
plugin after all?
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.
@echebbi maybe we should/could. I'm a bit worried by the fact that people using Pitclipse would have more mutators than those using Maven and ignoring the new pitest-rv
, but maybe we can rely on them knowing the Maven plugin as well.
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.
By default we run Pitest's DEFAULT mutator group so our mutators set would still be the same as a bare Pitest configuration. pitest-rv
's mutators would only be exposed through the preferences/configuration pages which feels fair to me.
We can even add a column to the mutators table that explicitely states the origin of each mutator:
Name | Description | Contributor |
---|---|---|
Conditionals Boundary | Replaces the relational operators <, <=, >, >= | pitest |
Negation | Replaces any use of a numeric variable (local variable, field, array cell) with its negation | pitest-rv-plugin |
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.
@echebbi yes that'd be useful; but would such information be easily (automatically) retrieved and easy to maintain?
Moreover, with pitest-rv
we would restore the "old defaults" or not?
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.
would such information be easily (automatically) retrieved and easy to maintain?
It might be possible to retrieve/infer the information through reflection. My intuition is that since we have access to the MethodFactoryFactory
instances (each mutation operator is implemented as a child of MethodMutatorFactory
) we should be able to get the info with something along the lines of:
// maps plugin ID to the name we want to display in the table
//
Map<String, String> pluginIdToContributorName = Map.of(
"org.pitest", "pitest",
"org.pitest.pitest-rv-plugin", "pitest-rv"
);
Collection<MethodMutatorFactory> mutators = ServiceLoader.load(MethodMutatorFactory.class, IsolationUtils.getContextClassLoader());
for (MethodMutatorFactory mutator : mutators) {
//
// retrieve the contributor through reflection
//
Bundle bundle = FrameworkUtil.getBundle(mutator.getClass());
//
// update our 'Mutators' enum with the contributor name
//
String contributorName = pluginIdToContributorName.get(bundle.getBundleId());
Mutators.valueOf(mutator.getName()).setContributorName(contributorName);
}
Or, if we want to be really extensible it should be possible to craft a solution based on a custom extension point so that external plug-ins can provide new mutators without having to change a single piece of code in Pitclipse's core. That would require some refactoring though so I believe that such a work would deserve its own PR.
Moreover, with pitest-rv we would restore the "old defaults" or not?
We wouldn't because this group is not related to the research operators and has been completely removed. We may want to somehow support the groups related to research operators though.
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.
@echebbi thanks for the clarification, especially about the old defaults, which are now gone for good. I thought the pitest-rv
was related to that so I was reluctant to add pitest-rv
right away because that would have required to undo the removal of old defaults, but it's not like that :)
So, shall we address pitest-rv
in a new PR and go on with this one?
I would also try to build with Java 21 and have a UI test with Java 21, but we can do that in another PR as well.
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.
shall we address
pitest-rv
in a new PR and go on with this one?
@LorenzoBettini fine by me!
bcd0943
to
d6d0ba2
Compare
Finally a green build 🎉@LorenzoBettini thanks for your help :) I'm not 100% confident regarding the new mutators/groups set and the current results though. I think we should take some time to make sure everything is ok before merging. |
Quality Gate passedIssues Measures |
@echebbi shall we merge this and release? |
1 similar comment
@echebbi shall we merge this and release? |
Closes #221 by upgrading Pitest to 1.15.8
This upgrade comes with several API breaking changes. A notable change is the removal of several "research-oriented" mutators from PIT and which are now wrapped in a dedicated PIT plug-in. See hcoles/pitest#993 for the changes and #221 (comment) for our decision to discard those mutators for now.