harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Petrashkova (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4351) [buildtest][vts] Test vm/jvmti/funcs/GetOwnedMonitorInfo/GetOwnedMonitorInfo0101/GetOwnedMonitorInfo0101.xml is incorrect
Date Thu, 05 Jul 2007 09:56:05 GMT
[buildtest][vts] Test vm/jvmti/funcs/GetOwnedMonitorInfo/GetOwnedMonitorInfo0101/GetOwnedMonitorInfo0101.xml
is incorrect
-------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4351
                 URL: https://issues.apache.org/jira/browse/HARMONY-4351
             Project: Harmony
          Issue Type: Bug
          Components: build - test - ci
            Reporter: Vera Petrashkova


According to J2SE JVMTI specification method 
GetOwnedMonitorInfo (jvmtiEnv* env, 
            jthread thread, 
            jint* owned_monitor_count_ptr, 
            jobject** owned_monitors_ptr)

returns information about the monitors owned by the specified thread. 
It saves the number of monitors to owned_monitor_count_ptr.

The following VTS test 
     vm/jvmti/funcs/GetOwnedMonitorInfo/GetOwnedMonitorInfo0101/GetOwnedMonitorInfo0101.xml
creates thread "Owner". 
This "Owner" thread
- acquires 7 monitors on sync0 - sync6 objects;
- starts new thread "agent"
The method Thread.start in DRLVM is synchronized, so the thread also acquires the monitor
on object which corresponds 
to the "agent" thread.

As the result GetOwnedMonitorInfo returns information about 8 monitors for "Owner" thread.

But this test passes only when returned "owned_monitor_count_ptr" equals 7.
See source code:
----------- GetOwnedMonitorInfo0101.cpp------------------
void JNICALL callbackThreadStart(prms_THRD_START)
{
...
    result = jvmti_env->GetAllThreads(&tcount, &threads);
    fprintf(stderr, "\tnative: GetAllThreads result = %d (must be zero) \n", result);
    if (result != JVMTI_ERROR_NONE) return;

    for ( int i = 0; i < tcount; i++ )
    {
        result = jvmti_env->GetThreadInfo(threads[i], &tinfo);
        fprintf(stderr, "\tnative: GetThreadInfo result = %d (must be zero) \n", result);
        fprintf(stderr, "\tnative: current thread name is %s (must be zero) \n", tinfo.name);
        if (result != JVMTI_ERROR_NONE) continue;
        if (strcmp(tinfo.name, "Owner")) continue;
        my_thread = threads[i];
        fprintf(stderr, "\tnative: tested thread was found = %p\n", my_thread);

        break;
    }

    util = true;
    result = jvmti_env->GetOwnedMonitorInfo(my_thread,
                &owned_monitor_count, &owned_monitors);
    fprintf(stderr, "\tnative: GetOwnedMonitorInfo result = %d (must be zero) \n", result);
    flag = true;
    fprintf(stderr, "\n\tnative: number of waited threads is %d (must be 7)\n",
         owned_monitor_count );
    if ((result == JVMTI_ERROR_NONE) && (owned_monitor_count == 7)) {  <<<<<<<<<
        test = true;                                          <<<<<<<<<<<<<<<<<<
        return;
    }
}

void JNICALL callbackVMDeath(prms_VMDEATH)
{
    check_VMDEATH;

    fprintf(stderr, "\n\tTest of function GetOwnedMonitorInfo0101         : ");

    if (test && util)                                          <<<<<<<<<<<<<<<<
        fprintf(stderr, " passed \n");
    else
        fprintf(stderr, " failed \n");

    fprintf(stderr, "\n} /* test GetOwnedMonitorInfo0101 is finished */ \n");
    fflush(stderr);
}
--------------------------

This test fails on DRLVM and on BEA JRockit.
Test vm/jvmti/funcs/GetOwnedMonitorInfo/GetOwnedMonitorInfo0101/GetOwnedMonitorInfo0101.xml
is incorrect and should be fixed.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message