RFR (M): 8231595 [TEST] develop a test case for SuspendThreadList including current thread

Alex Menkov alexey.menkov at oracle.com
Mon Sep 30 20:41:17 UTC 2019


Name of the test doesn't look good (it's too general).
Maybe SuspendWithCurrentThread?


72                 throw new RuntimeException("Man: unable to prepare 
tested thread: " + threads[i]);

Do you mean "Main" (instead of "Man")?


In "run" method you don't actually need "boolean success"

109             success = checkSuspendedStatus(threads);
  110             if (!success) {
  111                 throw new RuntimeException("Main: FAILED status 
returned from checkTestedThreadsSuspended");
  112             }

==>
              if (!checkSuspendedStatus(threads)) {
                  throw new RuntimeException(...);
              }

  115             success = resumeTestedThreads();
  116             if (!success) {
  117                 throw new RuntimeException("Main: FAILED status 
returned from resumeTestedThreads");
  118             }

==>

              if (!resumeTestedThreads()) {
                  throw new RuntimeException(...);
              }


Looks like all native methods (except checkTestedThreadsSuspended) can 
return only JNI_TRUE (on error they call jni->FatalError)
So they can be void (and don't need to test returned value)

--alex

On 09/27/2019 18:25, serguei.spitsyn at oracle.com wrote:
> Please, review fix for test enhancement:
>    https://bugs.openjdk.java.net/browse/JDK-8231595
> 
> Webrev:
> http://cr.openjdk.java.net/~sspitsyn/webrevs/2019/8231595-jvmti-susp-tlist.1/ 
> 
> 
> Summary:
>    New test is a coverage for the JVMTI bug:
>      https://bugs.openjdk.java.net/browse/JDK-8217762
>        SuspendThreadList won't work correctly if the current thread is 
> not last in the list
> 
>    It provides a prove the bug JDK-8217762 does not exist
>    as the test is passed with the current implementation.
> 
> Thanks,
> Serguei


More information about the serviceability-dev mailing list