Comments (5)
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.
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](https://private-user-images.githubusercontent.com/78310039/335330904-9cfa2984-7f90-4330-a4d7-0144d72889bc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ5NzExMTksIm5iZiI6MTcyNDk3MDgxOSwicGF0aCI6Ii83ODMxMDAzOS8zMzUzMzA5MDQtOWNmYTI5ODQtN2Y5MC00MzMwLWE0ZDctMDE0NGQ3Mjg4OWJjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI5VDIyMzMzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1OWFhYTA5NTYzOGZjYjdkYjliNTVmMzRkZjk2ZTcwNTIyYWJjZTkxOGE5OGY5YzZhMTFjZTE4YzlmOWI4ZmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9N2zYE8UQ8woN6O6kqIx2iEWwoBFlQqC5CvR0tXLSnQ)
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.
What I meant was the following:
- Check which class implements the unit test that fails.
- 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 amain
, add one taking a different JPF test class as an example. - 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.
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.
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)
- java.lang.NoSuchMethodError: java.lang.String.getBytes([BIIBI) HOT 13
- cannot find native jdk.internal.misc.CDS.isDumpingClassList0 HOT 43
- `java.net.URI.toURI` broken
- Java 17: BufferMismatch now depends on native code: JPF crashes (missing native peer) if byte buffers differ
- `BufferTest.testCharBufferConstructor` uses random bytes HOT 96
- Test "gov.nasa.jpf.test.java.io.ObjectStreamTest and gov.nasa.jpf.test.java.io.testSimpleReadbackOk" Fails on Java 17 HOT 18
- Test "gov.nasa.jpf.test.java.concurrent.SemaphoreTest" fails on OpenJDK-17 HOT 16
- Assistance Needed with Deadlock Detection in JPF HOT 5
- "gov.nasa.jpf.test.java.concurrent.CountDownLatchTest" and "gov.nasa.jpf.test.java.concurrent.ExecutorServiceTest" fails on Java-17 HOT 16
- "gov.nasa.jpf.test.java.concurrent.ConcurrentSkipListMapTest" fails on Java-17 HOT 6
- Add support for package metadata in `JarClassFileContainer`
- Investigate `java.lang.invoke.MethodHandles$Lookup.findVarHandle` HOT 19
- NullPointerException in `java.util.jar.JarFile.getEntry0` method HOT 5
- Compiler warnings under Java 17 HOT 35
- java.lang.NoSuchMethodException: SharedSecrets.setJavaNetInetAddressAccess HOT 4
- Need Implementation of `JarFile`
- "record" feature in jpf-core/java-17 HOT 39
- "Sealed Class and Interface" feature of "OpenJDK-17" on JPF/java-17 HOT 9
- NumericValueChecker incorrectly reports out-of-range error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpf-core.