Skip to content
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

URLClassLoader unit tests fail under Windows #427

Open
ghost-cai opened this issue Dec 19, 2023 · 7 comments
Open

URLClassLoader unit tests fail under Windows #427

ghost-cai opened this issue Dec 19, 2023 · 7 comments

Comments

@ghost-cai
Copy link

ghost-cai commented Dec 19, 2023

I used the master branch.
gradle8.4
OpenJDK version 11
image
I have executed the command gradle build, and I got the test error.
image
image

java.lang.AssertionError: JPF found unexpected errors: gov.nasa.jpf.vm.NoUncaughtExceptionsProperty

Has the issue been fixed? I have saw the same error in this issue.
image

@ghost-cai ghost-cai changed the title > mmuesly's PR fixed a lot of issues at once. Thanks a lot! Now 11 failing tests left: java.lang.AssertionError: JPF found unexpected errors: gov.nasa.jpf.vm.NoUncaughtExceptionsProperty Dec 19, 2023
@cyrille-artho
Copy link
Member

Hi,
"Temurin" is Eclipse's JDK; it seems to be compatible with OpenJDK except for URLClassLoader. Are you running the tests under Windows? Perhaps there is an incompatibility there (rather than with Temurin).

@ghost-cai
Copy link
Author

I used jpf-core under windows with Intellij Idea. I got the result mentioned above.I tried to execute gradle build in cmd. I got the same error.
image
And I can't use the jpf-core.
image
Can you give some advises?

@cyrille-artho
Copy link
Member

This is likely because Windows' shell does not use standard "/" as directory separator, but a backslash instead. This can probably be addressed in JPF's model and native peer classes. As we don't have access to Windows, we cannot fix this, but we are happy to accept a patch that handles this issue.

@cyrille-artho cyrille-artho changed the title java.lang.AssertionError: JPF found unexpected errors: gov.nasa.jpf.vm.NoUncaughtExceptionsProperty URLClassLoader unit tests fail under Windows Dec 19, 2023
@ghost-cai
Copy link
Author

All right. Although there is still the error mentioned above, I can executed the java -jar RunJPF.jar HelloWorld.jpf.
And I got the result:
image
However, I alter the "HelloWorld.java"
from :

public class HelloWorld {
  public static void main(String[] args){
    System.out.println("I won't say it!");
  }
}

to :

public class HelloWorld {
  public void save(){
    System.out.println("save function!");
  }
}

I got the result shown below.
屏幕截图 2023-12-20 105524
Is there must a main function in the tested .class? If not, what should I do?

@cyrille-artho
Copy link
Member

Yes, JPF expects a regular Java application with a static main method as an entry point. If your code has no main method, you have to write one.

@ghost-cai
Copy link
Author

ghost-cai commented Dec 20, 2023

There are many class don't have "main function" in the jar of a project. Or, it can be said that a project usually has only one "main function". Can jpf test this jar? Can jpf test these classes? Can jpf used to a whole web project? Such as ,testing some interfaces.

@cyrille-artho
Copy link
Member

JPF essentially performs a system test by default, but it can also be used to run unit tests. The latter mode is used to test JPF itself. Please see the wiki for more information.
To test the contents of a JAR file, you usually want to mix system tests (calling main with different parameters) and unit tests, as far as there is non-determinism in the form of thread scheduling or input choices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants