-
Notifications
You must be signed in to change notification settings - Fork 358
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
Master #510
base: master
Are you sure you want to change the base?
Master #510
Conversation
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 think there is a typo, please fix it so we can try the CI build/test again.
yeah sure @cyrille-artho |
Could you suggest me any changes, according to the errors the code encountered. @cyrille-artho |
Thanks! The build file works now, but one of the paths seems to be wrong, and
See the full log here: https://github.com/javapathfinder/jpf-core/actions/runs/12714274234/job/35472592178?pr=510 |
Thanks for quoting the issue @cyrille-artho . I would be working on the on some amendments and would come up with a new PR. |
Hey! @cyrille-artho could this issue be assigned to me? |
This is a PR, not an issue. I can assign an issue to you once you have made a successful PR. This version works better than the previous one, but it still results in build failures:
I can see that |
corrected the paths of C.java and D.java Added explicit dependencies in compileTestJava, compileModules, createJpfClassesJar
The build was successful on my system @cyrille-artho |
Great! I can confirm that the new build now works. This resolves the most difficult step.
|
@cyrille-artho Thanks!! I would surely be working on these two points and will revert back in a day. |
checks whether JPF incorrectly allows a static call to a non-static method. The test has passed and the build was successful.
I have created the test file and have successfully checked whether JPF incorrectly allows a static call to a non-static method. The build was successful. @cyrille-artho |
Hi,
So your test can try that and call If you adapt the test, it should first fail, because JPF does not check the |
I think it's a good idea to first try to get a "properly failing" test, so we are sure that the expected exception is checked against in the right way. After that, the one-line change in JPF to fix the test can easily be confirmed as valid by rerunning the test against the fix. |
@cyrille-artho Sure!! I would that and will revert back asap. I have understood the issue. Thank you @cyrille-artho for the clear guidance. It really makes easy for me to proceed towards next steps. |
When I am rebuilding, the exception is caught and the test fails with the message.
I have tested the failure case successfully and have made a PR to show it. But I am not able to get what can I do next. @cyrille-artho can you give me some suggestions. |
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.
Please remove temp. files and move the test files to the right place. You might not need C.java
anymore. Furthermore, the tests no longer compile, so please check your build.
__test__
Outdated
@@ -0,0 +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.
Please remove any temporary files in the PR. Change the test so any such files are removed at the end of the test.
src/main/gov/nasa/jpf/D.java
Outdated
@@ -0,0 +1,8 @@ | |||
package gov.nasa.jpf; |
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.
These files should be in src/test
.
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.
Please remove this file (as it is no longer needed, we have src/test/.../D.java
now.
src/main/java/C.java
Outdated
@@ -0,0 +1,7 @@ | |||
class C { |
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.
Move to src/test
.
src/main/java/D.java
Outdated
@@ -0,0 +1,3 @@ | |||
class D { |
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.
Move to src/test
.
As of now, some test files need to be moved to
|
…emporary files. Stored D.java in src/test. Updated dependencies for JUNIT5. The build was successful.
@cyrille-artho I have made the suggested changes for cleaning up files and removing them at the end. Made some dependency changes in build.gradle. Updated StaticCallToNonStaticTest.java. |
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.
Great, you have almost all the points resolved. There are a few changes remaining, but I hope they will be easy to do. Please see my comments.
src/main/gov/nasa/jpf/D.java
Outdated
@@ -0,0 +1,8 @@ | |||
package gov.nasa.jpf; |
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.
Please remove this file (as it is no longer needed, we have src/test/.../D.java
now.
src/test/C.java
Outdated
@@ -0,0 +1,7 @@ | |||
class C { |
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 think this file can be deleted, as testStaticCallToNonStatic
does not use it, and we don't need a standalone example; once testStaticCallToNonStatic
works as intended, it is simple enough to copy this to main
in an empty class if one wants a standalone program to run the test.
@Test | ||
public void testStaticCallToNonStatic() { | ||
// Create an instance of D | ||
D instance = new D(); |
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.
Please remove.
// Expect IncompatibleClassChangeError when calling instance.m() | ||
try { | ||
System.out.println("Calling m() method"); | ||
instance.m(); // This should throw IncompatibleClassChangeError |
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 has to be D.m();
(like in C.java
).
|
||
// Expect IncompatibleClassChangeError when calling instance.m() | ||
try { | ||
System.out.println("Calling m() method"); |
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.
The println
statement here can be deleted, as it is not desirable in a unit test to print to the console.
Thank you very much! The process is mostly working now, but you accidentally changed the static to a dynamic call in the test; please see my comments. Another thing I have not commented on, for some reason, this time, only one test (for your new feature) was run, rather than over 1000 tests. I don't know if this is due to change in the build/test process in |
Having now tried a clean clone with the test, I see that there is a problem with the new build dependencies.
We want |
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.
Regarding build dependencies.
build.gradle
Outdated
@@ -76,16 +114,20 @@ tasks.named('compilePeersJava') { | |||
tasks.named('compileTestJava') { | |||
dependsOn(copyLibs) | |||
dependsOn(copyResources) | |||
mustRunAfter(modifyAndCompileD) |
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 think this is reversed. I am not very familiar with the Gradle DSL, and the documentation is not 100 % clear, but this dependency and others (even some that have been declared previously) might be redundant or reversed. Please look at the dependencies and ensure that the original unit tests are preserved, so we have again over 1000 tests in the CI build/test.
You can check this by running ./gradlew clean test
.
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.
The original 1010 now run again, but the new test does not run yet.
I think I've found the incorrect (reverse) dependency in build.gradle
; please try to change that and run the tests again.
build.gradle
Outdated
@@ -76,16 +112,25 @@ tasks.named('compilePeersJava') { | |||
tasks.named('compileTestJava') { | |||
dependsOn(copyLibs) | |||
dependsOn(copyResources) | |||
shouldRunAfter(modifyAndCompileD) |
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 dependency should be the other way around: in the declaration of modifyAndCompileD
, that task should run after compileTestJava
, so we first compile the tests normally and then modify D.java
and re-compile it.
Thanks for tidying up the PR. The 1010 basic tests now run and pass, but the new test does not run for some reason.
(where |
…ets StaticCallToNonStaticTest. And the build was fine.
Hey @cyrille-artho I have added a new test to specifically target the StaticCallToNonStaticTest.java. The final build was also successful. So, could you please check it and provide me with needful suggestions. |
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.
Please also add the new test target to the GitHub action, so the additional test is executed after the regular unit tests have passed.
Please remove lib
, as the library dependencies are specified in build.gradle
and downloaded automatically.
Hey @cyrille-artho I have made the changes assuring the successful build of new test and the old tests. |
Thanks! I can see that the new Gradle target |
@cyrille-artho Now my new test is targeting
The build was also successful with successful running of other 1010 tests. |
I checked it with method |
Hey @cyrille-artho could you please check the changes. |
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.
Thanks, I can see that the test is now executed.
Please make sure the test expects an exception of the right type, as it currently passes due to JPF not throwing the required exception.
Also, try to remove settings.json
and the "cleanup" function unless the latter is really needed.
} | ||
|
||
// Cleanup method to delete the temporary file after tests | ||
@AfterClass |
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 cleanup function needed? Your new test does not create a temp. file directly. If this happens due to some side effect somewhere, we can ignore it (and add that file to .gitignore
).
|
||
@Test | ||
public void testStaticCallToNonStatic() { | ||
D.m(); |
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 test should expect an exception: Try
Assertions.assertThrows(java.lang.IncompatibleClassChangeError, D.m());
This should make the test fail, so we can ensure that the fix that we need is tested against.
After the fix is in place, the test will succeed.
Hi,
I've now run the tests and checked the output. Please make the new test
*fail* for now, as the required check and exceptions are not there yet. A
fix later on will make the test pass.
…On Wed, Jan 29, 2025 at 11:31 AM sanidhya00081 ***@***.***> wrote:
Hey @cyrille-artho <https://github.com/cyrille-artho> could you please
check the changes.
—
Reply to this email directly, view it on GitHub
<#510 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABXV4R5MRSBXWUB5UAYGSIT2NCUXJAVCNFSM6AAAAABU4QQC6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRRGI2TCOBUGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Regards,
Cyrille Artho
|
Now the test first fails with an error and after the correction all the test pass.
Now, first the test fails with an error and later it passes with successful build.
Updated .gitignore by placing seetings.jason into it. The build was successful.
Hey @cyrille-artho please check my last commits. All the things work as intended. The test first fails and after the correction it passes. I have updated the clean-up thing as well as |
@cyrille-artho The failed build has occurred as to show that the test runs against incorrect function. |
Should I now proceed with the correction after that the build will be successful @cyrille-artho |
Great job, we now have a test that reproduces the problem. Next, we want to fix the issue.
Helper method |
Yes, please try the fix I outlined; if it works, all old and new tests will pass. |
Hey @cyrille-artho , I am stuck solving the issue from last 5 days but the concept I am implementing in INVOKESTATIC.java is not wrking properly I think or I can say that it is not throwing exception properly. Here is the code I am implementing in INVOKESTATIC.java inside execute method:
Could you provide me with any suggestions that what could I be doing wrong or any tips or ideas. |
Your suggested change looks good. Where in the code did you put the check? What is the result? |
included StaticCallToNonStaticTest.class in test in build.gradle
@cyrille-artho In my PR you could see that I added the check in |
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.
Method D.m
needs to be static when the main source tree is compiled, otherwise, compilation fails.
|
||
public class D { | ||
// Non-static method | ||
public void m() { |
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 method should be static but then be compiled separately as a non-static method after an edit (which is made by build.gradle
).
After making |
Integrated a mechanism to detect and prevent invalid INVOKESTATIC calls by validating method properties during runtime in JPF (line 274).
Optimized the test pipeline by using Gradle-native methods to manage input-output dependencies, ensuring task portability and proper execution order.