Giter VIP home page Giter VIP logo

Comments (5)

cyrille-artho avatar cyrille-artho commented on August 30, 2024

This one may be a bit more difficult to debug. The problem is a logical problem: The native peer requests four bytes (from 0 to 3), but the string is of length 1.
Several possibilities:

  • The logic is wrong somewhere and updates internal data incorrectly, so later, more content is requested than what actually exists.
  • A conversion/encoding issue results in a discrepancy between the available and expected number of bytes.

Can you create a standalone example from test, with a .jpf file that executes the problematic test through JPF's command line interface? Then, we can try to use the MethodTracker to see what methods are called on the target String.

from jpf-core.

eklaDFF avatar eklaDFF commented on August 30, 2024

What will the content of example ? I mean what example will test this ?

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I tried to find the inner implementation of getBytes(...). And then applied there.

Screenshot 2024-05-30 at 11 41 04 PM

Now our failed tests reduced.

Test Execution: FAILURE
Summary: 1002 tests, 995 passed, 7 failed, 0 skipped

1002 tests completed, 7 failed

> Task :test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.

But why our own logic failed here ?

from jpf-core.

cyrille-artho avatar cyrille-artho commented on August 30, 2024

What I meant was the following:

  1. Check which class implements the unit test that fails.
  2. Check if the source of that unit test also has a main method. Many JPF tests have that, to facilitate running them as a small stand-alone program. If you can't find a main, add one taking a different JPF test class as an example.
  3. If you run the test from the command line through its main, you get more information about why it fails.
    There is an internal assumption in the code that no longer holds under Java 11; we first have to find out why the test fails before we can fix it.

from jpf-core.

eklaDFF avatar eklaDFF commented on August 30, 2024

running jpf with args:
JavaPathfinder core system v8.0 (rev 9e0c527) - (C) 2005-2014 United States Government. All rights reserved.

====================================================== system under test
gov.nasa.jpf.test.java.nio.BufferTest.runTestMethod()

====================================================== search started: 03/06/24, 12:14 pm
[WARNING] orphan NativePeer method: jdk.internal.misc.Unsafe.getUnsafe()Lsun/misc/Unsafe;
[WARNING] orphan NativePeer method: java.util.ResourceBundle.getClassContext()[Ljava/lang/Class;
running jpf with args:
JavaPathfinder core system v8.0 (rev 9e0c527) - (C) 2005-2014 United States Government. All rights reserved.

====================================================== system under test
gov.nasa.jpf.test.java.nio.BufferTest.runTestMethod()

====================================================== search started: 03/06/24, 12:14 pm
[WARNING] orphan NativePeer method: jdk.internal.misc.Unsafe.getUnsafe()Lsun/misc/Unsafe;
[WARNING] orphan NativePeer method: java.lang.StringCoding.decode([BII)[C
[WARNING] orphan NativePeer method: java.lang.StringCoding.encode([CII)[B

====================================================== error 1
gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.UnsatisfiedLinkError: cannot find native jdk.internal.misc.ScopedMemoryAccess.registerNatives
at jdk.internal.misc.ScopedMemoryAccess.registerNatives(no peer)
at jdk.internal.misc.ScopedMemoryAccess.(ScopedMemoryAccess.java:83)
at java.nio.BufferMismatch.(BufferMismatch.java:35)
at java.nio.ByteBuffer.equals(ByteBuffer.java:311)
at gov.nasa.jpf.test.java.nio.BufferTest.testByteBufferConstructor(BufferTest.java:45)
at java.lang.reflect.Method.invoke(gov.nasa.jpf.vm.JPF_java_lang_reflect_Method)
at gov.nasa.jpf.util.test.TestJPF.runTestMethod(TestJPF.java:648)

====================================================== snapshot #1
thread java.lang.Thread:{id:0,name:main,status:RUNNING,priority:5,isDaemon:false,lockCount:0,suspendCount:0}
owned locks:java.lang.Class@2d0,java.lang.Class@2d3
call stack:
at jdk.internal.misc.ScopedMemoryAccess.(ScopedMemoryAccess.java:83)
at java.nio.BufferMismatch.(BufferMismatch.java:35)
at java.nio.ByteBuffer.equals(ByteBuffer.java:311)
at gov.nasa.jpf.test.java.nio.BufferTest.testByteBufferConstructor(BufferTest.java:45)
at java.lang.reflect.Method.invoke(Method.java)
at gov.nasa.jpf.util.test.TestJPF.runTestMethod(TestJPF.java:648)

====================================================== results
error #1: gov.nasa.jpf.vm.NoUncaughtExceptionsProperty "java.lang.UnsatisfiedLinkError: cannot find native..."

====================================================== search finished: 03/06/24, 12:14 pm

from jpf-core.

cyrille-artho avatar cyrille-artho commented on August 30, 2024

I see. We first want to understand what has changed in the string contents for the strings created by BufferTest.testCharBufferConstructor. Please use a debugger or add some logging code to see this. (You may have to log the content in hexadecimal to see exactly what the contents are.)

from jpf-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.