You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/08/23 18:49:21 UTC
svn commit: r434076 [5/18] - in /incubator/harmony/enhanced/drlvm/trunk:
build/make/components/ build/make/components/vm/ build/make/targets/
build/patches/lnx/ build/patches/lnx/APR/ build/patches/lnx/APR/threadproc/
build/patches/lnx/APR/threadproc/u...
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_performance_concurrent_mutex.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_performance_concurrent_mutex.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_performance_concurrent_mutex.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_performance_concurrent_mutex.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,352 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Alexander Shipilov
+ * @version $Revision: 1.1.2.3 $
+ */
+
+#include "test_performance.h"
+
+int test_hythread_cuncurrent_mutex_apr(apr_thread_t* apr_threads_array[],
+ int THREADS_NUMBER, apr_thread_start_t func);
+
+int test_hythread_cuncurrent_mutex_tm(hythread_t threads_array[],
+ int THREADS_NUMBER, hythread_entrypoint_t func);
+
+int check_result_few_threads(int difference, int otherdiff);
+
+int test_hythread_cuncurrent_mutex_run_test_few_threads(int THREADS_NUMBER,
+ apr_thread_t* apr_threads_array[],
+ apr_thread_start_t apr_func,
+ hythread_t threads_array[],
+ hythread_entrypoint_t hythread_func);
+
+int test_hythread_cuncurrent_mutex_run_test(int THREADS_NUMBER,
+ apr_thread_t* apr_threads_array[],
+ apr_thread_start_t apr_func,
+ hythread_t threads_array[],
+ hythread_entrypoint_t hythread_func);
+
+int iterations;
+
+/*
+ * Concurrent mutex functions
+ */
+
+int proc_concurrent(void *args) {
+
+ int j = 0;
+
+ hymutex_lock(tm_mutex_lock);
+ hycond_wait(tm_condition_lock, tm_mutex_lock);
+ hymutex_unlock(tm_mutex_lock);
+
+ for (j = 0; j < iterations; j++) {
+ hymutex_lock(tm_concurrent_mutex_lock);
+ concurrent_mutex_data = 1;
+ hymutex_unlock(tm_concurrent_mutex_lock);
+ }
+
+ return 0;
+}
+
+void* APR_THREAD_FUNC proc_apr_concurrent(apr_thread_t *thread, void *args) {
+
+ int j = 0;
+
+ apr_thread_mutex_lock(apr_mutex_lock);
+ apr_thread_cond_wait(apr_condition_lock, apr_mutex_lock);
+ apr_thread_mutex_unlock(apr_mutex_lock);
+
+ for (j = 0; j < iterations; j++) {
+ apr_thread_mutex_lock(apr_concurrent_mutex_lock);
+ concurrent_mutex_data = 1;
+ apr_thread_mutex_unlock(apr_concurrent_mutex_lock);
+ }
+ return 0;
+}
+
+/*
+ * Concurrent mutex tests
+ */
+
+int test_hythread_cuncurrent_mutex1(void){
+
+ const int THREADS_NUMBER = 1;
+ hythread_t threads_array[1];
+ apr_thread_t* apr_threads_array[1];
+
+ return test_hythread_cuncurrent_mutex_run_test_few_threads(THREADS_NUMBER,
+ apr_threads_array,
+ proc_apr_concurrent,
+ threads_array,
+ proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex2(void){
+
+ const int THREADS_NUMBER = 2;
+ hythread_t threads_array[2];
+ apr_thread_t* apr_threads_array[2];
+
+ return test_hythread_cuncurrent_mutex_run_test_few_threads(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex4(void){
+
+ const int THREADS_NUMBER = 4;
+ hythread_t threads_array[4];
+ apr_thread_t* apr_threads_array[4];
+
+ return test_hythread_cuncurrent_mutex_run_test_few_threads(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex8(void){
+
+ const int THREADS_NUMBER = 8;
+ hythread_t threads_array[8];
+ apr_thread_t* apr_threads_array[8];
+
+ return test_hythread_cuncurrent_mutex_run_test_few_threads(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex16(void){
+
+ const int THREADS_NUMBER = 16;
+ hythread_t threads_array[16];
+ apr_thread_t* apr_threads_array[16];
+
+ return test_hythread_cuncurrent_mutex_run_test(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex32(void){
+
+ const int THREADS_NUMBER = 32;
+ hythread_t threads_array[32];
+ apr_thread_t* apr_threads_array[32];
+
+ return test_hythread_cuncurrent_mutex_run_test(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex64(void){
+
+ const int THREADS_NUMBER = 64;
+ hythread_t threads_array[64];
+ apr_thread_t* apr_threads_array[64];
+
+ return test_hythread_cuncurrent_mutex_run_test(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex128(void){
+
+ const int THREADS_NUMBER = 128;
+ hythread_t threads_array[128];
+ apr_thread_t* apr_threads_array[128];
+
+ return test_hythread_cuncurrent_mutex_run_test(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex256(void){
+
+ const int THREADS_NUMBER = 256;
+ hythread_t threads_array[256];
+ apr_thread_t* apr_threads_array[256];
+
+ return test_hythread_cuncurrent_mutex_run_test(THREADS_NUMBER,
+ apr_threads_array, proc_apr_concurrent, threads_array, proc_concurrent);
+}
+
+int test_hythread_cuncurrent_mutex_run_test(int THREADS_NUMBER,
+ apr_thread_t* apr_threads_array[],
+ apr_thread_start_t apr_func,
+ hythread_t threads_array[],
+ hythread_entrypoint_t hythread_func)
+{
+ long difference = 0, aprdiff = 0;
+
+ iterations = concurrent_mutex_iterations;
+
+ /* APR test */
+ tested_threads_run(default_run_for_test);
+ aprdiff = test_hythread_cuncurrent_mutex_apr(apr_threads_array, THREADS_NUMBER, apr_func);
+ tested_threads_destroy();
+
+ /* Thread manager test */
+ tested_threads_run(default_run_for_test);
+ difference = test_hythread_cuncurrent_mutex_tm(threads_array, THREADS_NUMBER, hythread_func);
+ tested_threads_destroy();
+
+ return check_result(difference, aprdiff);
+}
+
+int test_hythread_cuncurrent_mutex_run_test_few_threads(int THREADS_NUMBER,
+ apr_thread_t* apr_threads_array[],
+ apr_thread_start_t apr_func,
+ hythread_t threads_array[],
+ hythread_entrypoint_t hythread_func)
+{
+ long difference = 0, aprdiff = 0;
+
+ iterations = concurrent_mutex_iterations_few_threads;
+
+ /* APR test */
+ tested_threads_run(default_run_for_test);
+ aprdiff = test_hythread_cuncurrent_mutex_apr(apr_threads_array, THREADS_NUMBER, apr_func);
+ tested_threads_destroy();
+
+ /* Thread manager test */
+ tested_threads_run(default_run_for_test);
+ difference = test_hythread_cuncurrent_mutex_tm(threads_array, THREADS_NUMBER, hythread_func);
+ tested_threads_destroy();
+
+ return check_result_few_threads(difference, aprdiff);
+}
+
+int test_hythread_cuncurrent_mutex_apr(apr_thread_t* apr_threads_array[],
+ int THREADS_NUMBER, apr_thread_start_t func)
+{
+ int i;
+
+ apr_time_t start, end;
+
+ void *args = NULL;
+ apr_threadattr_t *apr_attrs = NULL;
+
+ apr_pool_t* pool;
+ apr_pool_t* locks_pool;
+
+ apr_status_t statapr;
+
+ for (i = 0; i < THREADS_NUMBER; i++) {
+ apr_threads_array[i] = NULL;
+ }
+ // Create pools and locks
+ statapr = apr_pool_create(&pool, NULL);
+ assert(!statapr);
+ statapr = apr_pool_create(&locks_pool, NULL);
+ assert(!statapr);
+ statapr = apr_thread_cond_create(&apr_condition_lock, locks_pool);
+ assert(!statapr);
+ statapr = apr_thread_mutex_create(&apr_mutex_lock, APR_THREAD_MUTEX_DEFAULT, locks_pool);
+ assert(!statapr);
+ statapr = apr_thread_mutex_create(&apr_concurrent_mutex_lock, APR_THREAD_MUTEX_DEFAULT, locks_pool);
+ assert(!statapr);
+ // Create threads
+ for (i = 0; i < THREADS_NUMBER; i++) {
+ statapr = apr_thread_create(&apr_threads_array[i], apr_attrs, func, args, pool);
+ assert(!statapr);
+ }
+ jthread_sleep(1000, 1);
+ start = apr_time_now();
+ statapr = apr_thread_cond_broadcast(apr_condition_lock);
+ assert(!statapr);
+ for (i = 0; i < THREADS_NUMBER; i++) {
+ apr_thread_join(&statapr, apr_threads_array[i]);
+ assert(!statapr);
+ }
+ end = apr_time_now();
+ statapr = apr_thread_mutex_destroy(apr_concurrent_mutex_lock);
+ assert(!statapr);
+ statapr = apr_thread_mutex_destroy(apr_mutex_lock);
+ assert(!statapr);
+ statapr = apr_thread_cond_destroy(apr_condition_lock);
+ assert(!statapr);
+ apr_pool_destroy(locks_pool);
+ apr_pool_destroy(pool);
+ return (end - start);
+}
+
+int test_hythread_cuncurrent_mutex_tm(hythread_t threads_array[],
+ int THREADS_NUMBER, hythread_entrypoint_t func)
+{
+ int i;
+
+ apr_time_t start, end;
+
+ void *args = NULL;
+
+ IDATA stat;
+
+ for (i = 0; i < THREADS_NUMBER; i++) {
+ threads_array[i] = NULL;
+ }
+ stat = hycond_create(&tm_condition_lock);
+ assert(!stat);
+ stat = hymutex_create(&tm_mutex_lock, APR_THREAD_MUTEX_DEFAULT);
+ assert(!stat);
+ stat = hymutex_create(&tm_concurrent_mutex_lock, APR_THREAD_MUTEX_DEFAULT);
+ assert(!stat);
+ for (i = 0; i < THREADS_NUMBER; i++) {
+ hythread_create(&threads_array[i], 0, 0, 0, func, args);
+ }
+ jthread_sleep(1000, 1);
+ start = apr_time_now();
+ hycond_notify_all(tm_condition_lock);
+ for (i = 0; i < THREADS_NUMBER; i++) {
+ hythread_join(threads_array[i]);
+ }
+ end = apr_time_now();
+ stat = hymutex_destroy(tm_concurrent_mutex_lock);
+ assert(!stat);
+ stat = hymutex_destroy(tm_mutex_lock);
+ assert(!stat);
+ stat = hycond_destroy(tm_condition_lock);
+ assert(!stat);
+ return (end - start);
+}
+
+int check_result_few_threads(int difference, int otherdiff) {
+ float base, fraction;
+
+ base = difference / concurrent_mutex_iterations_few_threads;
+ fraction = difference % concurrent_mutex_iterations_few_threads;
+ fraction = fraction / concurrent_mutex_iterations_few_threads;
+ base = base + fraction;
+ log_info("TMN result is: %4.2f", base);
+
+ base = otherdiff / concurrent_mutex_iterations_few_threads;
+ fraction = otherdiff % concurrent_mutex_iterations_few_threads;
+ fraction = fraction / concurrent_mutex_iterations_few_threads;
+ base = base + fraction;
+ log_info("APR result is: %4.2f", base);
+
+ if (difference > (otherdiff * PERF_COEFFICIENT)) {
+ if (!(difference == 0 || otherdiff == 0)) {
+ return TEST_FAILED;
+ }
+ }
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ TEST(test_hythread_cuncurrent_mutex1)
+ TEST(test_hythread_cuncurrent_mutex2)
+ TEST(test_hythread_cuncurrent_mutex4)
+ TEST(test_hythread_cuncurrent_mutex8)
+ TEST(test_hythread_cuncurrent_mutex16)
+ TEST(test_hythread_cuncurrent_mutex32)
+ TEST(test_hythread_cuncurrent_mutex64)
+ TEST(test_hythread_cuncurrent_mutex128)
+ TEST(test_hythread_cuncurrent_mutex256)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_performance_concurrent_mutex.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_instrum.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_instrum.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_instrum.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_instrum.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/ti_thread.h>
+
+/*
+ * Test jthread_get_all_threads(...)
+ */
+int test_jthread_get_all_threads(void) {
+
+ tested_thread_sturct_t *tts;
+ jint all_threads_count = 99;
+ jint thread_count = 99;
+ jthread *threads = NULL;
+ int i;
+
+ // Initialize tts structures
+ tested_threads_init(TTS_INIT_COMMON_MONITOR);
+
+ tf_assert_same(jthread_get_thread_count(&thread_count), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_all_threads(&threads, &all_threads_count), TM_ERROR_NONE);
+ tf_assert_same(thread_count, 0);
+ tf_assert_same(all_threads_count, 0);
+ tf_assert_not_null(threads);
+ i = 0;
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ current_thread_tts = tts;
+ tts->java_thread->object->run_method = default_run_for_test;
+ tf_assert_same(jthread_create(tts->jni_env, tts->java_thread, &tts->attrs), TM_ERROR_NONE);
+ check_tested_thread_phase(tts, TT_PHASE_RUNNING);
+ tf_assert_same(jthread_get_thread_count(&thread_count), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_all_threads(&threads, &all_threads_count), TM_ERROR_NONE);
+ i++;
+ tf_assert_same(thread_count, i);
+ tf_assert_same(all_threads_count, i);
+ compare_threads(threads, i, 0);
+ }
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ current_thread_tts = tts;
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ tf_assert_same(jthread_get_thread_count(&thread_count), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_all_threads(&threads, &all_threads_count), TM_ERROR_NONE);
+ i--;
+ tf_assert_same(thread_count, i);
+ tf_assert_same(all_threads_count, i);
+ compare_threads(threads, i, 1);
+ }
+
+ // Terminate all threads (not needed here) and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_thread_count(...)
+ */
+int test_jthread_get_thread_count(void) {
+
+ return test_jthread_get_all_threads();
+}
+
+/*
+ * Test get_blocked_count(...)
+ */
+void run_for_test_jthread_get_blocked_count(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_blocked_count(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts;
+ int i;
+ int waiting_on_monitor_nmb;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_blocked_count);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+
+ waiting_on_monitor_nmb = 0;
+ critical_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ critical_tts = tts;
+ }
+ }
+ tf_assert_same(jthread_get_blocked_count(&waiting_on_monitor_nmb), TM_ERROR_NONE);
+ if (MAX_TESTED_THREAD_NUMBER - waiting_on_monitor_nmb - i != 1){
+ tf_fail("Wrong number waiting on monitor threads");
+ }
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_deadlocked_threads(...)
+ */
+void run_for_test_jthread_get_deadlocked_threads(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ IDATA status;
+
+ if (tts->my_index < 2){
+ status = jthread_monitor_enter(tts->monitor);
+ }
+
+ tts->phase = TT_PHASE_RUNNING;
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ if (tts->my_index == 0){
+ status = jthread_monitor_enter(get_tts(1)->monitor);
+ } else if (tts->my_index == 1){
+ status = jthread_monitor_enter(get_tts(0)->monitor);
+ }
+ tts->phase = TT_PHASE_DEAD;
+}
+
+int test_jthread_get_deadlocked_threads(void) {
+
+ tested_thread_sturct_t * tts;
+ jthread *thread_list;
+ int dead_list_count;
+ jthread *dead_list;
+ int i = 0;
+ apr_status_t apr_status;
+ apr_pool_t *pool = NULL;
+
+ apr_status = apr_pool_create(&pool, NULL);
+ thread_list = apr_palloc(pool, sizeof(int) * MAX_TESTED_THREAD_NUMBER);
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run_with_different_monitors(run_for_test_jthread_get_deadlocked_threads);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ thread_list[i] = tts->java_thread;
+ i++;
+ }
+ tf_assert_same(jthread_get_deadlocked_threads(thread_list, MAX_TESTED_THREAD_NUMBER,
+ &dead_list, &dead_list_count), TM_ERROR_NONE);
+ tf_assert_same(dead_list_count, 0);
+
+ reset_tested_thread_iterator(&tts);
+ next_tested_thread(&tts);
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_ANY);
+ next_tested_thread(&tts);
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_ANY);
+ tf_assert_same(jthread_get_deadlocked_threads(thread_list, MAX_TESTED_THREAD_NUMBER,
+ &dead_list, &dead_list_count), TM_ERROR_NONE);
+ tf_assert_same(dead_list_count, 2);
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test get_wated_count(...)
+ */
+void run_for_test_jthread_get_waited_count(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_RUNNING;
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_monitor_enter(monitor);
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_WAITING_ON_WAIT : TT_PHASE_ERROR);
+ status = jthread_monitor_wait(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ status = jthread_monitor_exit(monitor);
+
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_waited_count(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *running_tts;
+ int i;
+ int waiting_nmb;
+ jobject monitor;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_waited_count);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+
+ waiting_nmb = 0;
+ running_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_RUNNING){
+ running_tts = tts;
+ }
+ }
+ tf_assert_same(jthread_get_waited_count(&waiting_nmb), TM_ERROR_NONE);
+ if (waiting_nmb != i){
+ tf_fail("Wrong number waiting on monitor threads");
+ }
+ if (running_tts){
+ running_tts->stop = 1;
+ }
+ check_tested_thread_phase(running_tts, TT_PHASE_WAITING_ON_WAIT);
+ }
+ reset_tested_thread_iterator(&tts);
+ next_tested_thread(&tts);
+ monitor = tts->monitor;
+ tf_assert_same(jthread_monitor_enter(monitor), TM_ERROR_NONE);
+ tf_assert_same(jthread_monitor_notify_all(monitor), TM_ERROR_NONE);
+ tf_assert_same(jthread_monitor_exit(monitor), TM_ERROR_NONE);
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ TEST(test_jthread_get_all_threads)
+ TEST(test_jthread_get_thread_count)
+ TEST(test_jthread_get_blocked_count)
+ //TEST(test_jthread_get_deadlocked_threads)
+ TEST(test_jthread_get_waited_count)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_instrum.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_local_storage.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_local_storage.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_local_storage.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_local_storage.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/ti_thread.h>
+
+/*
+ * Test jthread_set_local_storage(...)
+ */
+int test_jthread_set_local_storage(void) {
+
+
+ tested_thread_sturct_t *tts;
+ void * data;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(default_run_for_test);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ tf_assert_same(jthread_set_local_storage(tts->java_thread, (const void*)tts), TM_ERROR_NONE);
+ }
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ tf_assert_same(jthread_get_local_storage(tts->java_thread, &data), TM_ERROR_NONE);
+ tf_assert_same(data, tts);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_local_storage(...)
+ */
+int test_jthread_get_local_storage(void) {
+
+ return test_jthread_set_local_storage();
+}
+
+TEST_LIST_START
+ TEST(test_jthread_set_local_storage)
+ TEST(test_jthread_get_local_storage)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_local_storage.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_monitor_info.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_monitor_info.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_monitor_info.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_monitor_info.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,281 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/hythread_ext.h>
+#include <open/ti_thread.h>
+
+/*
+ * Test jthread_get_contended_monitor(...)
+ */
+void run_for_test_jthread_get_contended_monitor(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ // End critical section
+ status = jthread_monitor_exit(monitor);
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_contended_monitor(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts = NULL;
+ jobject contended_monitor;
+ int i;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_contended_monitor);
+
+ reset_tested_thread_iterator(&tts);
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+ critical_tts = NULL;
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ tf_assert_same(jthread_get_contended_monitor(tts->java_thread, &contended_monitor), TM_ERROR_NONE);
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert_null(contended_monitor);
+ tf_assert_null(critical_tts);
+ critical_tts = tts;
+ } else if (tts->phase != TT_PHASE_DEAD){
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_MONITOR);
+ tf_assert(vm_objects_are_equal(contended_monitor, tts->monitor));
+ }
+ }
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_holds_lock(...)
+ */
+void run_for_test_jthread_holds_lock(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_holds_lock(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts = NULL;
+ int blocked_count;
+ int i;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_holds_lock);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+ blocked_count = 0;
+ critical_tts = NULL;
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert(jthread_holds_lock(tts->java_thread, tts->monitor) > 0);
+ tf_assert_null(critical_tts);
+ critical_tts = tts;
+ } else if (tts->phase != TT_PHASE_DEAD){
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_MONITOR);
+ tf_assert(jthread_holds_lock(tts->java_thread, tts->monitor) == 0);
+ if (tts->phase == TT_PHASE_WAITING_ON_MONITOR){
+ blocked_count++;
+ }
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ tf_assert_same(blocked_count, MAX_TESTED_THREAD_NUMBER - i - 1);
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_lock_owner(...)
+ */
+void run_for_test_jthread_get_lock_owner(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_lock_owner(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts = NULL;
+ jthread lock_owner = NULL;
+ int blocked_count;
+ int i;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_lock_owner);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+ blocked_count = 0;
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ critical_tts = tts;
+ } else if (tts->phase == TT_PHASE_WAITING_ON_MONITOR){
+ blocked_count++;
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ tf_assert_same(blocked_count, MAX_TESTED_THREAD_NUMBER - i - 1);
+ tf_assert_same(jthread_get_lock_owner(critical_tts->monitor, &lock_owner), TM_ERROR_NONE);
+ tf_assert(lock_owner);
+ tf_assert_same(critical_tts->java_thread->object, lock_owner->object);
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_owned_monitors(...)
+ */
+void run_for_test_jthread_get_owned_monitors(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_owned_monitors(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts;
+ int i;
+ jint owned_monitors_count;
+ jobject *owned_monitors = NULL;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_owned_monitors);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+ critical_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ tf_assert_same(jthread_get_owned_monitors (tts->java_thread,
+ &owned_monitors_count, &owned_monitors), TM_ERROR_NONE);
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert(critical_tts == NULL); // error if two threads in critical section
+ critical_tts = tts;
+ tf_assert_same(owned_monitors_count, 1);
+ tf_assert_same(owned_monitors[0]->object, tts->monitor->object);
+ } else if (tts->phase == TT_PHASE_WAITING_ON_MONITOR){
+ tf_assert_same(owned_monitors_count, 0);
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ TEST(test_jthread_get_contended_monitor)
+ TEST(test_jthread_holds_lock)
+ TEST(test_jthread_get_lock_owner)
+ TEST(test_jthread_get_owned_monitors)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_monitor_info.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_peak_count.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_peak_count.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_peak_count.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_peak_count.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/hythread_ext.h>
+#include <open/ti_thread.h>
+
+int helper_get_reset_peak_count(void);
+/*
+ * Test jthread_reset_peak_thread_count(...)
+ */
+int test_jthread_reset_peak_thread_count(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_get_reset_peak_count();
+}
+
+/*
+ * Test jthread_get_peak_thread_count(...)
+ */
+int test_jthread_get_peak_thread_count(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_get_reset_peak_count();
+}
+
+void run_for_helper_get_reset_peak_count(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ IDATA status;
+ int i;
+ int num = 0;
+
+ status = jthread_reset_peak_thread_count();
+ tts->peak_count = 0;
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_RUNNING : TT_PHASE_ERROR);
+ while(1){
+ for (i = 0; i < 1000; i++){
+ num = num + 1;
+ }
+ if (tts->stop) {
+ break;
+ }
+ sleep_a_click();
+ }
+ status = jthread_get_peak_thread_count(&tts->peak_count);
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int helper_get_reset_peak_count(void) {
+
+ tested_thread_sturct_t *tts;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_helper_get_reset_peak_count);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ printf("peak_count = %i \n", tts->peak_count);
+ tf_assert(tts->peak_count > 0);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ //TEST(test_jthread_reset_peak_thread_count)
+ //TEST(test_jthread_get_peak_thread_count)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_peak_count.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_raw_monitors.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_raw_monitors.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_raw_monitors.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_raw_monitors.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,393 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/ti_thread.h>
+
+int test_jthread_raw_monitor_destroy(void);
+int helper_jthread_raw_monitor_enter_exit(void);
+int helper_jthread_raw_monitor_try_enter(void);
+int helper_jthread_raw_wait_notify(void);
+int helper_jthread_raw_wait_notify_all(void);
+
+/*
+ * Raw monitors
+ */
+
+int test_jthread_raw_monitor_create(void) {
+
+ return test_jthread_raw_monitor_destroy();
+}
+
+int test_jthread_raw_monitor_destroy(void) {
+
+ jrawMonitorID raw_monitor;
+ IDATA status;
+
+ status = jthread_raw_monitor_create(&raw_monitor);
+ if (status != TM_ERROR_NONE){
+ return TEST_FAILED;
+ }
+ status = jthread_raw_monitor_destroy(raw_monitor);
+ if (status != TM_ERROR_NONE){
+ return TEST_FAILED;
+ }
+ return TEST_PASSED;
+}
+
+int test_jthread_raw_monitor_enter(void) {
+
+ return helper_jthread_raw_monitor_enter_exit();
+}
+
+int test_jthread_raw_monitor_try_enter(void) {
+
+ return helper_jthread_raw_monitor_try_enter();
+}
+
+int test_jthread_raw_monitor_exit(void) {
+
+ return helper_jthread_raw_monitor_enter_exit();
+}
+
+int test_jthread_raw_notify(void) {
+
+ return helper_jthread_raw_wait_notify();
+}
+
+int test_jthread_raw_notify_all(void) {
+
+ return helper_jthread_raw_wait_notify_all();
+}
+
+int test_jthread_raw_wait(void) {
+
+ return helper_jthread_raw_wait_notify();
+}
+
+/*
+ * ------------------------ HELPERS -----------------------
+ */
+
+/*
+ * Test jthread_raw_monitor_enter(...)
+ * Test jthread_raw_monitor_exit(...)
+ */
+//?????????????????????????????? jthread_raw_monitor_init and not init
+//?????????????????????????????? jthread_raw_monitor_exit without enter
+void run_for_helper_jthread_raw_monitor_enter_exit(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jrawMonitorID monitor = tts->raw_monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_raw_monitor_enter(monitor);
+
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_raw_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int helper_jthread_raw_monitor_enter_exit(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts;
+ int i;
+ int waiting_on_monitor_nmb;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_helper_jthread_raw_monitor_enter_exit);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+
+ waiting_on_monitor_nmb = 0;
+ critical_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert(critical_tts == NULL); // error if two threads in critical section
+ critical_tts = tts;
+ } else if (tts->phase == TT_PHASE_WAITING_ON_MONITOR){
+ waiting_on_monitor_nmb++;
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ if (MAX_TESTED_THREAD_NUMBER - waiting_on_monitor_nmb - i != 1){
+ tf_fail("Wrong number waiting on monitor threads");
+ }
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_raw_wait(...)
+ * Test jthread_raw_notify(...)
+ */
+void run_for_helper_jthread_raw_wait_notify(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jrawMonitorID monitor = tts->raw_monitor;
+ IDATA status;
+ int64 msec = 1000000;
+
+ status = jthread_raw_monitor_enter(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ // Begin critical section
+ tts->phase = TT_PHASE_WAITING_ON_WAIT;
+ status = jthread_raw_monitor_wait(monitor, msec);
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_raw_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int helper_jthread_raw_wait_notify(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts;
+ jrawMonitorID monitor;
+ int64 msec = 1000000;
+ int i;
+ int waiting_on_wait_nmb;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_helper_jthread_raw_wait_notify);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ monitor = tts->raw_monitor; // the same for all tts
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_WAIT);
+ }
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+
+ waiting_on_wait_nmb = 0;
+ critical_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ tf_assert(tts->phase != TT_PHASE_IN_CRITICAL_SECTON);
+ }
+ tf_assert_same(jthread_raw_monitor_notify(monitor), TM_ERROR_NONE);
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert(critical_tts == NULL); // error if two threads in critical section
+ critical_tts = tts;
+ } else if (tts->phase == TT_PHASE_WAITING_ON_WAIT){
+ waiting_on_wait_nmb++;
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ if (MAX_TESTED_THREAD_NUMBER - waiting_on_wait_nmb - i != 1){
+ tf_fail("Wrong number waiting on monitor threads");
+ }
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_raw_wait(...)
+ * Test jthread_raw_notify_all(...)
+ */
+void run_for_helper_jthread_raw_wait_notify_all(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jrawMonitorID monitor = tts->raw_monitor;
+ int64 msec = 1000000;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_raw_monitor_enter(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ // Begin critical section
+ tts->phase = TT_PHASE_WAITING_ON_WAIT;
+ status = jthread_raw_monitor_wait(monitor, msec);
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_raw_monitor_exit(monitor);
+ // Exit critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int helper_jthread_raw_wait_notify_all(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts;
+ jrawMonitorID monitor;
+ int i;
+ int waiting_on_wait_nmb;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_helper_jthread_raw_wait_notify_all);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ monitor = tts->raw_monitor;
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_WAIT);
+ }
+ tf_assert_same(jthread_raw_monitor_enter(monitor), TM_ERROR_NONE);
+ tf_assert_same(jthread_raw_monitor_notify_all(monitor), TM_ERROR_NONE);
+ tf_assert_same(jthread_raw_monitor_enter(monitor), TM_ERROR_NONE);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+
+ waiting_on_wait_nmb = 0;
+ critical_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert(critical_tts == NULL); // error if two threads in critical section
+ critical_tts = tts;
+ } else if (tts->phase == TT_PHASE_WAITING_ON_WAIT){
+ waiting_on_wait_nmb++;
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ if (MAX_TESTED_THREAD_NUMBER - waiting_on_wait_nmb - i != 1){
+ tf_fail("Wrong number waiting on monitor threads");
+ }
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+void run_for_helper_jthread_raw_monitor_try_enter(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jrawMonitorID monitor = tts->raw_monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_raw_monitor_try_enter(monitor);
+ while (status == TM_ERROR_EBUSY){
+ status = jthread_raw_monitor_try_enter(monitor);
+ sleep_a_click();
+ }
+ // Begin critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_IN_CRITICAL_SECTON : TT_PHASE_ERROR);
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ status = jthread_raw_monitor_exit(monitor);
+ // End critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int helper_jthread_raw_monitor_try_enter(void) {
+
+ tested_thread_sturct_t *tts;
+ tested_thread_sturct_t *critical_tts;
+ int i;
+ int waiting_on_monitor_nmb;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_helper_jthread_raw_monitor_try_enter);
+
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+
+ waiting_on_monitor_nmb = 0;
+ critical_tts = NULL;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_ANY); // to make thread running
+ if (tts->phase == TT_PHASE_IN_CRITICAL_SECTON){
+ tf_assert(critical_tts == NULL); // error if two threads in critical section
+ critical_tts = tts;
+ } else if (tts->phase == TT_PHASE_WAITING_ON_MONITOR){
+ waiting_on_monitor_nmb++;
+ }
+ }
+ tf_assert(critical_tts); // thread in critical section found
+ if (MAX_TESTED_THREAD_NUMBER - waiting_on_monitor_nmb - i != 1){
+ tf_fail("Wrong number waiting on monitor threads");
+ }
+ critical_tts->stop = 1;
+ check_tested_thread_phase(critical_tts, TT_PHASE_DEAD);
+ }
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ TEST(test_jthread_raw_monitor_create)
+ TEST(test_jthread_raw_monitor_destroy)
+ TEST(test_jthread_raw_monitor_enter)
+ TEST(test_jthread_raw_monitor_try_enter)
+ TEST(test_jthread_raw_monitor_exit)
+ //TEST(test_jthread_raw_notify)
+ //TEST(test_jthread_raw_notify_all)
+ //TEST(test_jthread_raw_wait)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_raw_monitors.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_state.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_state.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_state.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_state.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,431 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/hythread_ext.h>
+#include <open/ti_thread.h>
+
+/*
+ * Test jthread_get_state(...)
+ *
+ * called function tested state
+ *
+ * Not Alive, New (state == 0)
+ * hythread_create() ALIVE | RUNNABLE
+ * jthread_interrupt() ALIVE | RUNNABLE | INTERRUPTED
+ * jthread_clear_interrupted() ALIVE | RUNNABLE
+ * DEAD
+ */
+void run_for_test_jthread_get_state_1(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+
+ tts->phase = TT_PHASE_RUNNING;
+ while(1){
+ hythread_safe_point();
+ tts->clicks++;
+ hythread_yield();
+ if (tts->stop) {
+ break;
+ }
+ }
+ tts->phase = TT_PHASE_DEAD;
+}
+
+int test_jthread_get_state_1(void) {
+
+ tested_thread_sturct_t *tts;
+ int state;
+ int ref_state;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_init(TTS_INIT_COMMON_MONITOR);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ tf_assert_same(state, ref_state);
+ }
+
+ // Run all tested threads
+ tested_threads_run_common(run_for_test_jthread_get_state_1);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_RUNNING);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x5;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+
+ tf_assert_same(jthread_interrupt(tts->java_thread), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x200005;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+
+ tf_assert_same(jthread_clear_interrupted(tts->java_thread), TM_ERROR_INTERRUPT);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x5;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x2;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+/*
+ * Test jthread_get_state(...)
+ */
+void run_for_test_jthread_get_state_2(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ // Begin critical section
+ tts->phase = TT_PHASE_WAITING_ON_WAIT;
+ status = jthread_monitor_wait(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ status = jthread_monitor_exit(monitor);
+ // Exit critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_RUNNING : TT_PHASE_ERROR);
+ while(1){
+ hythread_safe_point();
+ tts->clicks++;
+ hythread_yield();
+ if (tts->stop) {
+ break;
+ }
+ }
+ tts->phase = TT_PHASE_DEAD;
+}
+
+int test_jthread_get_state_2(void) {
+
+ tested_thread_sturct_t *tts;
+ jobject monitor;
+ IDATA status;
+ int state;
+ int ref_state;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_init(TTS_INIT_COMMON_MONITOR);
+
+ // Lock monitor
+ reset_tested_thread_iterator(&tts);
+ next_tested_thread(&tts);
+ monitor = tts->monitor;
+ status = jthread_monitor_enter(monitor);
+
+ // Run all tested threads
+ tested_threads_run_common(run_for_test_jthread_get_state_2);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_MONITOR);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x401;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+ }
+ // Release monitor
+ status = jthread_monitor_exit(monitor);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_WAIT);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x191;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Lock monitor
+ status = jthread_monitor_enter(monitor);
+ status = jthread_monitor_notify_all(monitor);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_WAIT);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x401;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Release monitor
+ status = jthread_monitor_exit(monitor);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_RUNNING);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x5;
+ if(tts->my_index == 0){
+ printf("state = %08x (%08x)\n", state, ref_state);
+ }
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_state(...)
+ */
+void run_for_test_jthread_get_state_3(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ // Begin critical section
+ tts->phase = TT_PHASE_WAITING_ON_WAIT;
+ status = jthread_monitor_timed_wait(monitor, 1000000, 100);
+ if (status != TM_ERROR_INTERRUPT){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ status = jthread_monitor_exit(monitor);
+ // Exit critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_state_3(void) {
+
+ tested_thread_sturct_t *tts;
+ int state;
+ int ref_state;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_state_3);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_WAITING_ON_WAIT);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x1a1;
+ printf("state = %08x (%08x)\n", state, ref_state);
+ //tf_assert_same(state, ref_state);
+ tf_assert_same(jthread_interrupt(tts->java_thread), TM_ERROR_NONE);
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x2;
+ printf("state = %08x (%08x)\n", state, ref_state);
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_state(...)
+ */
+void run_for_test_jthread_get_state_4(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ jobject monitor = tts->monitor;
+ IDATA status;
+
+ tts->phase = TT_PHASE_WAITING_ON_MONITOR;
+ status = jthread_monitor_enter(monitor);
+ if (status != TM_ERROR_NONE){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ // Begin critical section
+ tts->phase = TT_PHASE_WAITING_ON_WAIT;
+ status = jthread_monitor_timed_wait(monitor, CLICK_TIME_MSEC, 0);
+ if (status != TM_ERROR_TIMEOUT){
+ tts->phase = TT_PHASE_ERROR;
+ return;
+ }
+ status = jthread_monitor_exit(monitor);
+ // Exit critical section
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_state_4(void) {
+
+ tested_thread_sturct_t *tts;
+ int state;
+ int ref_state;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_state_4);
+
+ // Wait for all threads wait timeout
+ jthread_sleep(20 * CLICK_TIME_MSEC * MAX_TESTED_THREAD_NUMBER, 0);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x2;
+ printf("state = %08x (%08x)\n", state, ref_state);
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_state(...)
+ */
+void run_for_test_jthread_get_state_5(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ IDATA status;
+
+ tts->phase = TT_PHASE_SLEEPING;
+ status = hythread_sleep(1000000);
+ tts->phase = (status == TM_ERROR_INTERRUPT ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_state_5(void) {
+
+ tested_thread_sturct_t *tts;
+ int state;
+ int ref_state;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_state_5);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_SLEEPING);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0;
+ printf("state = %08x (%08x)\n", state, ref_state);
+ //tf_assert_same(state, ref_state);
+ tf_assert_same(jthread_interrupt(tts->java_thread), TM_ERROR_NONE);
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0;
+ printf("state = %08x (%08x)\n", state, ref_state);
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+/*
+ * Test jthread_get_state(...)
+ */
+void run_for_test_jthread_get_state_6(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ IDATA status;
+
+ tts->phase = TT_PHASE_SLEEPING;
+ status = hythread_sleep(CLICK_TIME_MSEC);
+ tts->phase = (status == TM_ERROR_NONE ? TT_PHASE_DEAD : TT_PHASE_ERROR);
+}
+
+int test_jthread_get_state_6(void) {
+
+ tested_thread_sturct_t *tts;
+ int state;
+ int ref_state;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_test_jthread_get_state_6);
+
+ // Wait for all threads wait timeout
+ jthread_sleep(20 * CLICK_TIME_MSEC * MAX_TESTED_THREAD_NUMBER, 0);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ tf_assert_same(jthread_get_state(tts->java_thread, &state), TM_ERROR_NONE);
+ ref_state = 0x2;
+ printf("state = %08x (%08x)\n", state, ref_state);
+ //tf_assert_same(state, ref_state);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ //TEST(test_jthread_get_state_1)
+ //TEST(test_jthread_get_state_2)
+ //TEST(test_jthread_get_state_3)
+ //TEST(test_jthread_get_state_4)
+ //TEST(test_jthread_get_state_5)
+ TEST(test_jthread_get_state_6)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_state.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_timing.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_timing.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_timing.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_timing.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/hythread_ext.h>
+#include <open/ti_thread.h>
+
+int helper_hythread_cpu_timing(void);
+
+/*
+ * CPU timing
+ */
+
+int test_jthread_get_thread_cpu_time(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_hythread_cpu_timing();
+}
+
+int test_jthread_get_thread_user_cpu_time(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_hythread_cpu_timing();
+}
+
+int test_jthread_get_thread_blocked_time(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_hythread_cpu_timing();
+}
+
+int test_jthread_get_thread_waited_time(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_hythread_cpu_timing();
+}
+
+int test_jthread_get_thread_cpu_timer_info(void) {
+
+ log_info("NO IMPLEMENTTATION TO TEST");
+ return TEST_FAILED;
+ return helper_hythread_cpu_timing();
+}
+
+void run_for_helper_hythread_cpu_timing(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+ int i;
+ int num = 0;
+
+ tts->phase = TT_PHASE_RUNNING;
+ while(1){
+ for (i = 0; i < 1000; i++){
+ num = num + 1;
+ }
+ if (tts->stop) {
+ break;
+ }
+ sleep_a_click();
+ }
+ tts->phase = TT_PHASE_DEAD;
+}
+
+int helper_hythread_cpu_timing(void) {
+
+ tested_thread_sturct_t *tts;
+ jlong cpu_time;
+ jlong user_cpu_time;
+ jlong blocked_time;
+ jlong waited_time;
+ jvmtiTimerInfo timer_info;
+
+ log_info("NO IMPLEMENTATION TO TEST");
+ return TEST_FAILED;
+
+ // Initialize tts structures and run all tested threads
+ tested_threads_run(run_for_helper_hythread_cpu_timing);
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+
+ tf_assert_same(jthread_get_thread_cpu_time(tts->java_thread, &cpu_time), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_thread_user_cpu_time(tts->java_thread, &user_cpu_time), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_thread_blocked_time(tts->java_thread, &blocked_time), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_thread_waited_time(tts->java_thread, &waited_time), TM_ERROR_NONE);
+ tf_assert_same(jthread_get_thread_cpu_timer_info(&timer_info), TM_ERROR_NONE);
+
+ tf_assert(user_cpu_time > 0);
+ printf("=================================================== %08x\n", cpu_time);
+ printf("cpu_time = %i \n", cpu_time);
+ printf("user_cpu_time = %i \n", user_cpu_time);
+ printf("blocked_time = %i \n", blocked_time);
+ printf("waited_time = %i \n", waited_time);
+ printf("cpu_time = %i \n", cpu_time);
+
+ printf("jvmtiTimerInfo :\n");
+ printf("max_value = %i \n", timer_info.max_value);
+ printf("may_skip_forward = %i \n", timer_info.may_skip_forward);
+ printf("may_skip_backward = %i \n", timer_info.may_skip_backward);
+ printf("kind = %i \n", timer_info.kind);
+ }
+
+ // Terminate all threads and clear tts structures
+ tested_threads_destroy();
+
+ return TEST_PASSED;
+}
+
+TEST_LIST_START
+ //TEST(test_jthread_get_thread_cpu_time)
+ //TEST(test_jthread_get_thread_user_cpu_time)
+ //TEST(test_jthread_get_thread_waited_time)
+ //TEST(test_jthread_get_thread_blocked_time)
+ //TEST(test_jthread_get_thread_cpu_timer_info)
+TEST_LIST_END;
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/test_ti_timing.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_main.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_main.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_main.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_main.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+
+void setup() {
+
+ //log_set_level(2);
+ log_debug("setup");
+
+ test_java_thread_setup();
+}
+
+void teardown(void) {
+
+ log_debug("teardown");
+
+ test_java_thread_teardown();
+}
+
+int main(int argc, char *argv[]) {
+
+ int res;
+ res = default_main(argc, argv);
+ //printf("RES = %i\nPress <Enter> for exit\n", res);
+ //getchar();
+
+ return res;
+}
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_main.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_utils.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_utils.c?rev=434076&view=auto
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_utils.c (added)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_utils.c Wed Aug 23 09:48:41 2006
@@ -0,0 +1,390 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "testframe.h"
+#include "thread_unit_test_utils.h"
+#include <open/jthread.h>
+#include <open/hythread.h>
+#include <open/hythread_ext.h>
+#include <open/ti_thread.h>
+#include "apr_time.h"
+
+
+/*
+ * Utilities for thread manager unit tests
+ */
+
+tested_thread_sturct_t * current_thread_tts;
+tested_thread_sturct_t dummy_tts_struct;
+tested_thread_sturct_t * dummy_tts = &dummy_tts_struct;
+tested_thread_sturct_t tested_threads[MAX_TESTED_THREAD_NUMBER];
+
+void sleep_a_click(void){
+ apr_sleep(CLICK_TIME_MSEC * 1000);
+}
+
+void test_java_thread_setup(void) {
+
+ log_debug("test_java_thread_init()");
+ jni_init();
+ hythread_init(NULL);
+ hythread_attach(NULL);
+}
+
+void test_java_thread_teardown(void) {
+
+ IDATA status;
+
+ log_debug("test_java_thread_shutdown()");
+ hythread_detach(NULL);
+
+ // status = tm_shutdown(); ??????????????? fix me:
+ // second testcase don't work after tm_shutdown() call
+ status = TM_ERROR_NONE;
+
+ /*
+ * not required, if there are running threads tm will exit with
+ * error TM_ERROR_RUNNING_THREADS
+ */
+ if(!(status == TM_ERROR_NONE || status == TM_ERROR_RUNNING_THREADS)){
+ log_error("test_java_thread_shutdown() FAILED: %d", status);
+ }
+}
+
+void tested_threads_init(int mode){
+
+ tested_thread_sturct_t *tts;
+ jobject monitor;
+ jrawMonitorID raw_monitor;
+ IDATA status;
+ int i;
+
+ if (mode != TTS_INIT_DIFFERENT_MONITORS){
+ monitor = new_jobject();
+ status = jthread_monitor_init(monitor);
+ tf_assert_same_v(status, TM_ERROR_NONE);
+ }
+ status = jthread_raw_monitor_create(&raw_monitor);
+ tf_assert_same_v(status, TM_ERROR_NONE);
+
+ reset_tested_thread_iterator(&tts);
+ for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+ tts = &tested_threads[i];
+ tts->my_index = i;
+ //tf_assert_null(tts->java_thread);
+ tts->java_thread = new_jobject();
+ //tf_assert_null(tts->jni_env);
+ tts->jni_env = new_JNIEnv();
+// tts->attrs.priority = 5;
+ tts->jvmti_start_proc_arg = &tts->jvmti_start_proc_arg;
+ tts->clicks = 0;
+ tts->phase = TT_PHASE_NONE;
+ tts->stop = 0;
+ if (mode == TTS_INIT_DIFFERENT_MONITORS){
+ monitor = new_jobject();
+ status = jthread_monitor_init(monitor);
+ tf_assert_same_v(status, TM_ERROR_NONE);
+ }
+ tts->monitor = monitor;
+ tts->raw_monitor = raw_monitor;
+ tts->excn = NULL;
+ }
+}
+
+//void tested_threads_shutdown(void){
+//
+// tested_thread_sturct_t *tts;
+// int i;
+//
+// reset_tested_thread_iterator(&tts);
+// for (i = 0; i < MAX_TESTED_THREAD_NUMBER; i++){
+// tts = &tested_threads[i];
+// delete_jobject(tts->java_thread);
+// delete_JNIEnv(tts->jni_env);
+// }
+//}
+
+tested_thread_sturct_t *get_tts(int tts_index){
+
+ if (tts_index >= 0 && tts_index < MAX_TESTED_THREAD_NUMBER){
+ return &tested_threads[tts_index];
+ }
+ return (void *)NULL;
+}
+
+int next_tested_thread(tested_thread_sturct_t **tts_ptr){
+
+ tested_thread_sturct_t *tts = *tts_ptr;
+ int tts_index;
+
+ if (! tts){
+ tts = &tested_threads[0];
+ } else {
+ tts_index = tts->my_index;
+ if (tts_index >= 0 && tts_index < MAX_TESTED_THREAD_NUMBER - 1){
+ tts = &tested_threads[tts_index + 1];
+ } else {
+ tts = NULL;
+ }
+ }
+ *tts_ptr = tts;
+ return tts != NULL;
+}
+
+int prev_tested_thread(tested_thread_sturct_t **tts_ptr){
+
+ tested_thread_sturct_t *tts = *tts_ptr;
+ int tts_index;
+
+ if (! tts){
+ tts = &tested_threads[MAX_TESTED_THREAD_NUMBER - 1];
+ } else {
+ tts_index = tts->my_index;
+ if (tts_index > 0 && tts_index < MAX_TESTED_THREAD_NUMBER){
+ tts = &tested_threads[tts_index - 1];
+ } else {
+ tts = NULL;
+ }
+ }
+ *tts_ptr = tts;
+ return tts != NULL;
+}
+
+void reset_tested_thread_iterator(tested_thread_sturct_t **tts){
+ *tts = (void *)NULL;
+}
+
+void tested_threads_run_common(run_method_t run_method_param){
+
+ tested_thread_sturct_t *tts;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ current_thread_tts = tts;
+ tts->java_thread->object->run_method = run_method_param;
+ tf_assert_same_v(jthread_create(tts->jni_env, tts->java_thread, &tts->attrs), TM_ERROR_NONE);
+ check_tested_thread_phase(tts, TT_PHASE_ANY);
+ check_tested_thread_structures(tts);
+ }
+}
+
+void tested_threads_run(run_method_t run_method_param){
+
+ tested_threads_init(TTS_INIT_COMMON_MONITOR);
+ tested_threads_run_common(run_method_param);
+}
+
+void tested_threads_run_with_different_monitors(run_method_t run_method_param){
+
+ tested_threads_init(TTS_INIT_DIFFERENT_MONITORS);
+ tested_threads_run_common(run_method_param);
+}
+
+void tested_threads_run_with_jvmti_start_proc(jvmtiStartFunction jvmti_start_proc){
+
+ tested_thread_sturct_t *tts;
+
+ tested_threads_init(TTS_INIT_COMMON_MONITOR);
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ current_thread_tts = tts;
+ tf_assert_same_v(jthread_create_with_function(tts->jni_env, tts->java_thread, &tts->attrs,
+ jvmti_start_proc, tts->jvmti_start_proc_arg), TM_ERROR_NONE);
+ check_tested_thread_phase(tts, TT_PHASE_ANY);
+ }
+}
+
+void tested_os_threads_run(apr_thread_start_t run_method_param){
+
+ tested_thread_sturct_t *tts;
+ apr_thread_t *apr_thread;
+ apr_threadattr_t *apr_attrs = NULL;
+ apr_status_t status;
+ apr_pool_t *pool;
+
+ status = apr_pool_create(&pool, NULL);
+ tf_assert_v(status == APR_SUCCESS);
+ tested_threads_init(TTS_INIT_COMMON_MONITOR);
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ current_thread_tts = tts;
+ apr_thread = NULL;
+ // Create APR thread
+ status = apr_thread_create(
+ &apr_thread, // new thread OS handle
+ apr_attrs,
+ run_method_param, // start proc
+ NULL, // start proc arg
+ pool
+ );
+ tf_assert_v(status == APR_SUCCESS);
+ check_tested_thread_phase(tts, TT_PHASE_ANY);
+ }
+}
+
+int tested_threads_stop(){
+
+ tested_thread_sturct_t *tts;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ if (check_tested_thread_phase(tts, TT_PHASE_DEAD) != TEST_PASSED){
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ //Sleep(1000);
+ }
+ }
+ return TEST_PASSED;
+}
+
+int tested_threads_destroy(){
+
+ tested_thread_sturct_t *tts;
+
+ reset_tested_thread_iterator(&tts);
+ while(next_tested_thread(&tts)){
+ tts->stop = 1;
+ check_tested_thread_phase(tts, TT_PHASE_DEAD);
+ }
+ return TEST_PASSED;
+}
+
+int check_tested_thread_structures(tested_thread_sturct_t *tts){
+
+ jthread java_thread = tts->java_thread;
+ jvmti_thread_t jvmti_thread;
+ hythread_t hythread;
+
+ hythread = vm_jthread_get_tm_data(java_thread);
+ tf_assert(hythread);
+ jvmti_thread = hythread_get_private_data(hythread);
+ tf_assert(jvmti_thread);
+ /*
+ tf_assert_same(jvmti_thread->thread_object->object->data,
+ java_thread->object->data);
+ tf_assert_same(jvmti_thread->jenv, tts->jni_env);
+ */
+
+ //if(jvmti_thread->stop_exception != stop_exception){
+ // return TEST_FAILED; ????????????????????????????????????????????
+ //}
+
+ return TEST_PASSED;
+}
+
+int check_tested_thread_phase(tested_thread_sturct_t *tts, int phase){
+
+ int i;
+ for (i = 0; i < MAX_CLICKS_TO_WAIT; i++){
+ sleep_a_click(); // must be here to give tested thread to change phase
+
+ tf_assert(tts->phase != TT_PHASE_ERROR);
+ if (phase == tts->phase){
+ return 0;
+ }
+ if (phase == TT_PHASE_ANY && tts->phase != TT_PHASE_NONE){
+ return 0;
+ }
+ }
+
+ // tf_assert_same(phase, tts->phase);
+ return 0;
+}
+
+int tested_thread_is_running(tested_thread_sturct_t *tts){
+
+ int clicks = tts->clicks;
+ int i;
+
+ for (i = 0; i < MAX_CLICKS_TO_WAIT; i++){
+ sleep_a_click();
+ if (clicks != tts->clicks){
+ return 1;
+ }
+ }
+ return 0;
+}
+
+int compare_threads(jthread *threads, int thread_nmb, int compare_from_end) {
+
+ int i;
+ int j;
+ int found;
+ int tested_thread_start;
+ jthread java_thread;
+
+ // Check that all thread_nmb threads are different
+
+ //printf("----------------------------------------------- %i %i\n", thread_nmb, compare_from_end);
+ //for (j = 0; j < MAX_TESTED_THREAD_NUMBER; j++){
+ // printf("[%i] %p\n",j,tested_threads[j].java_thread->object);
+ //}
+ //printf("\n");
+ //for (i = 0; i < thread_nmb; i++){
+ // printf("!!! %p\n", (*(threads + i))->object);
+ //}
+ for (i = 0; i < thread_nmb - 1; i++){
+ java_thread = *(threads + i);
+ for (j = i + 1; j < thread_nmb; j++){
+ if (*(threads + j) == java_thread){
+ return TM_ERROR_INTERNAL;
+ }
+ }
+ }
+
+ // Check that the set of threads are equal to the set of the first
+ // or the last thread_nmb tested threads
+
+ tested_thread_start = compare_from_end ? MAX_TESTED_THREAD_NUMBER - thread_nmb : 0;
+ for (i = 0; i < thread_nmb; i++){
+ java_thread = *(threads + i);
+ found = 0;
+ for (j = tested_thread_start; j < thread_nmb + tested_thread_start; j++){
+ if (tested_threads[j].java_thread->object == java_thread->object){
+ found = 1;
+ break;
+ }
+ }
+ tf_assert(found);
+ }
+ return TM_ERROR_NONE;
+}
+
+int compare_pointer_sets(void ** set_a, void ** set_b, int nmb){
+ return TEST_FAILED;
+}
+
+int check_exception(jobject excn){
+
+ return TM_ERROR_INTERNAL;
+ //return TM_ERROR_NONE;
+}
+
+void default_run_for_test(void){
+
+ tested_thread_sturct_t * tts = current_thread_tts;
+
+ tts->phase = TT_PHASE_RUNNING;
+ while(1){
+ tts->clicks++;
+ sleep_a_click();
+ if (tts->stop) {
+ break;
+ }
+ }
+ tts->phase = TT_PHASE_DEAD;
+}
+
Propchange: incubator/harmony/enhanced/drlvm/trunk/vm/tests/unit/thread/utils/thread_unit_test_utils.c
------------------------------------------------------------------------------
svn:eol-style = native