1
1

32/64 fixes (ensure that our classes really at 64 bit clean -- and

they are!  Mostly the tests needed to be adjusted to run on 32 and 64
systems)

This commit was SVN r5185.
Этот коммит содержится в:
Jeff Squyres 2005-04-05 20:34:56 +00:00
родитель c19182a0d7
Коммит c36eab4749
3 изменённых файлов: 139 добавлений и 123 удалений

Просмотреть файл

@ -1,4 +1,3 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
@ -50,8 +49,11 @@ int main(int argc, char **argv) {
/* local variables */
ompi_cb_fifo_t fifo;
int i,size_of_fifo,lazy_free,return_status,error_cnt,loop_cnt;
void *ptr;
bool queue_empty;
union {
int ivalue;
void *vvalue;
} value;
#if 0
/* get queue size */
@ -76,57 +78,59 @@ int main(int argc, char **argv) {
if( OMPI_SUCCESS == return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init \n");
test_failure(" ompi_cv_fifo_init");
}
/* populate fifo */
/* populate fifo */
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
return_status=ompi_cb_fifo_write_to_head((void *)(i+5),&fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_head\n");
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
value.ivalue = i + 5;
return_status=ompi_cb_fifo_write_to_head(value.vvalue, &fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_head");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* try an over-fill the queue */
/* try an over-fill the queue */
error_cnt=0;
for( i=0 ; i < 3 ; i++ ) {
return_status=ompi_cb_fifo_write_to_head((void *)i,&fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR != return_status ) {
test_failure(" ompi_cb_fifo_write_to_head :: over-fill queue\n");
for( i=0 ; i < 3 ; i++ ) {
value.ivalue = i;
return_status=ompi_cb_fifo_write_to_head(value.vvalue, &fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR != return_status ) {
test_failure(" ompi_cb_fifo_write_to_head :: over-fill queue");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* pop items off the queue */
/* pop items off the queue */
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
ptr=ompi_cb_fifo_read_from_tail(&fifo,0,&queue_empty,
(size_t)pool.mpool_base());
if( (void *)(i+5) != ptr ) {
test_failure(" ompi_cb_fifo_read_from_tail\n");
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
value.vvalue =ompi_cb_fifo_read_from_tail(&fifo,0,&queue_empty,
(size_t)pool.mpool_base());
if( (i+5) != value.ivalue ) {
test_failure(" ompi_cb_fifo_read_from_tail (1)");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* free fifo */
return_status=ompi_cb_fifo_free(&fifo,&pool);
/* free fifo */
return_status=ompi_cb_fifo_free(&fifo,&pool);
if( OMPI_SUCCESS == return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init \n");
test_failure(" ompi_cv_fifo_init");
}
/* init fifo - lazy_free greater than size ==> should return error*/
@ -136,7 +140,7 @@ int main(int argc, char **argv) {
if( OMPI_SUCCESS != return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init with lazy_free too large \n");
test_failure(" ompi_cv_fifo_init with lazy_free too large");
}
/* split the writting of data to the slot to a reserve, and then a
@ -149,31 +153,31 @@ int main(int argc, char **argv) {
if( OMPI_SUCCESS == return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init \n");
test_failure(" ompi_cv_fifo_init");
}
/* populate fifo */
/* populate fifo */
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
return_status=ompi_cb_fifo_get_slot(&fifo,(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_get_slot \n");
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
return_status=ompi_cb_fifo_get_slot(&fifo,(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_get_slot");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* try an over-fill the queue */
/* try an over-fill the queue */
error_cnt=0;
for( i=0 ; i < 3 ; i++ ) {
return_status=ompi_cb_fifo_get_slot(&fifo,(size_t)pool.mpool_base());
if( OMPI_CB_ERROR != return_status ) {
test_failure(" ompi_cb_fifo_get_slot :: over-fill queue\n");
for( i=0 ; i < 3 ; i++ ) {
return_status=ompi_cb_fifo_get_slot(&fifo,(size_t)pool.mpool_base());
if( OMPI_CB_ERROR != return_status ) {
test_failure(" ompi_cb_fifo_get_slot :: over-fill queue");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
@ -181,96 +185,98 @@ int main(int argc, char **argv) {
/* write to slot - all slots previously reserved, so just use
* them now */
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
return_status=ompi_cb_fifo_write_to_slot(i,(void *)(i+5),&fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_slot \n");
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
value.ivalue = i + 5;
return_status=ompi_cb_fifo_write_to_slot(i, value.vvalue, &fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_slot");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* pop items off the queue */
/* pop items off the queue */
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
ptr=ompi_cb_fifo_read_from_tail(&fifo,0,&queue_empty,
(size_t)pool.mpool_base());
if( (void *)(i+5) != ptr ) {
test_failure(" ompi_cb_fifo_read_from_tail\n");
for( i=0 ; i < ompi_cb_fifo_size(&fifo); i++ ) {
value.vvalue = ompi_cb_fifo_read_from_tail(&fifo,0,&queue_empty,
(size_t)pool.mpool_base());
if( (i+5) != value.ivalue ) {
test_failure(" ompi_cb_fifo_read_from_tail (2)");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* free fifo */
return_status=ompi_cb_fifo_free(&fifo,&pool);
/* free fifo */
return_status=ompi_cb_fifo_free(&fifo,&pool);
if( OMPI_SUCCESS == return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init \n");
test_failure(" ompi_cv_fifo_init");
}
/* go through the fifo multiple times */
/* init fifo */
return_status=ompi_cb_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,
&pool);
return_status=ompi_cb_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,&pool);
/* check to see that retrun status is success */
if( OMPI_SUCCESS == return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init \n");
test_failure(" ompi_cv_fifo_init");
}
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size(&fifo)*loop_cnt ; i++ ) {
for( i=0 ; i < ompi_cb_fifo_size(&fifo)*loop_cnt ; i++ ) {
/* populate fifo */
return_status=ompi_cb_fifo_get_slot(&fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_get_slot \n");
return_status=ompi_cb_fifo_get_slot(&fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_get_slot");
error_cnt++;
}
}
/* write to the slot */
return_status=ompi_cb_fifo_write_to_slot(i%(ompi_cb_fifo_size(&fifo)),
(void *)(i+5),&fifo, (size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_slot \n");
value.ivalue = i + 5;
return_status=ompi_cb_fifo_write_to_slot(i%(ompi_cb_fifo_size(&fifo)),
value.vvalue, &fifo,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_slot");
error_cnt++;
}
}
/* pop items off the queue */
if( (i % ompi_cb_fifo_size(&fifo) ) ==
ompi_cb_fifo_size(&fifo)/2 ) {
ompi_cb_fifo_size(&fifo)/2 ) {
/* force a flush */
ptr=ompi_cb_fifo_read_from_tail(&fifo,1,&queue_empty,
(size_t)pool.mpool_base());
value.vvalue = ompi_cb_fifo_read_from_tail(&fifo,1,&queue_empty,
(size_t)pool.mpool_base());
} else {
ptr=ompi_cb_fifo_read_from_tail(&fifo,0,&queue_empty,
(size_t)pool.mpool_base());
value.vvalue = ompi_cb_fifo_read_from_tail(&fifo,0,&queue_empty,
(size_t)pool.mpool_base());
}
if( (void *)(i+5) != ptr ) {
test_failure(" ompi_cb_fifo_read_from_tail\n");
if( (i+5) != value.ivalue ) {
test_failure(" ompi_cb_fifo_read_from_tail (3)");
error_cnt++;
}
}
}
}
if( 0 == error_cnt ) {
test_success();
}
/* free fifo */
return_status=ompi_cb_fifo_free(&fifo,&pool);
/* free fifo */
return_status=ompi_cb_fifo_free(&fifo,&pool);
if( OMPI_SUCCESS == return_status ) {
test_success();
} else {
test_failure(" ompi_cv_fifo_init \n");
test_failure(" ompi_cv_fifo_init");
}
/* finalize result tracking */

Просмотреть файл

@ -1,4 +1,3 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
@ -50,9 +49,12 @@ int main(int argc, char **argv) {
/* local variables */
ompi_fifo_t fifo;
int i,j,size_of_fifo,lazy_free,return_status,error_cnt,loop_cnt;
void *ptr;
cb_slot_t *slot_data;
size_t cnt;
union {
int ivalue;
void *vvalue;
} value;
#if 0
/* get queue size */
@ -71,8 +73,7 @@ int main(int argc, char **argv) {
test_init("ompi_circular_buffer_fifo");
/* init fifo */
return_status=ompi_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,
&pool);
return_status=ompi_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,&pool);
/* check to see that retrun status is success */
if( OMPI_SUCCESS == return_status ) {
test_success();
@ -84,7 +85,8 @@ int main(int argc, char **argv) {
error_cnt=0;
for( i=0 ; i < loop_cnt*ompi_cb_fifo_size( (ompi_cb_fifo_t *)
&(fifo.head->cb_fifo)); i++ ) {
return_status=ompi_fifo_write_to_head((void *)(i+5),
value.ivalue = i + 5;
return_status=ompi_fifo_write_to_head(value.vvalue,
(ompi_fifo_t *)&(fifo), &pool, (size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_cb_fifo_write_to_head\n");
@ -98,8 +100,9 @@ int main(int argc, char **argv) {
error_cnt=0;
for( i=0 ; i < loop_cnt*ompi_cb_fifo_size( (ompi_cb_fifo_t *)
&(fifo.head->cb_fifo)); i++ ) {
ptr=ompi_fifo_read_from_tail(&fifo, (size_t)pool.mpool_base());
if( (void *)(i+5) != ptr ) {
value.vvalue = ompi_fifo_read_from_tail(&fifo,
(size_t)pool.mpool_base());
if( (i+5) != value.ivalue ) {
test_failure(" ompi_cb_fifo_read_from_tail\n");
error_cnt++;
}
@ -117,8 +120,7 @@ int main(int argc, char **argv) {
}
/* init fifo */
return_status=ompi_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,
&pool);
return_status=ompi_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,&pool);
/* check to see that retrun status is success */
if( OMPI_SUCCESS == return_status ) {
test_success();
@ -155,8 +157,10 @@ int main(int argc, char **argv) {
error_cnt=0;
for( i=0 ; i < loop_cnt*ompi_cb_fifo_size( (ompi_cb_fifo_t *)
&(fifo.head->cb_fifo)); i++ ) {
value.ivalue = i + 5;
return_status=ompi_fifo_write_to_slot(&(slot_data[i]),
(void *)(i+5), (size_t)pool.mpool_base());
value.vvalue,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
test_failure(" ompi_fifo_write_to_slot \n");
error_cnt++;
@ -170,8 +174,9 @@ int main(int argc, char **argv) {
error_cnt=0;
for( i=0 ; i < loop_cnt*ompi_cb_fifo_size( (ompi_cb_fifo_t *)
&(fifo.head->cb_fifo)); i++ ) {
ptr=ompi_fifo_read_from_tail(&fifo, (size_t)pool.mpool_base());
if( (void *)(i+5) != ptr ) {
value.vvalue = ompi_fifo_read_from_tail(&fifo,
(size_t)pool.mpool_base());
if( (i+5) != value.ivalue ) {
test_failure(" ompi_cb_fifo_read_from_tail II\n");
error_cnt++;
}
@ -192,8 +197,7 @@ int main(int argc, char **argv) {
* re-use slots
*/
/* init fifo */
return_status=ompi_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,
&pool);
return_status=ompi_fifo_init(size_of_fifo,lazy_free,0,0,0,&fifo,&pool);
/* check to see that retrun status is success */
if( OMPI_SUCCESS == return_status ) {
test_success();
@ -206,7 +210,8 @@ int main(int argc, char **argv) {
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size( (ompi_cb_fifo_t *)
&(fifo.head->cb_fifo)); i++ ) {
return_status=ompi_fifo_write_to_head((void *)((i+5)*(j+1)),
value.ivalue = (i + 5) * (j + 1);
return_status=ompi_fifo_write_to_head(value.vvalue,
(ompi_fifo_t *)&(fifo), &pool,
(size_t)pool.mpool_base());
if( OMPI_CB_ERROR == return_status ) {
@ -222,9 +227,9 @@ int main(int argc, char **argv) {
error_cnt=0;
for( i=0 ; i < ompi_cb_fifo_size( (ompi_cb_fifo_t *)
&(fifo.head->cb_fifo)); i++ ) {
ptr=ompi_fifo_read_from_tail(&fifo,
(size_t)pool.mpool_base());
if( (void *)((i+5)*(j+1)) != ptr ) {
value.vvalue = ompi_fifo_read_from_tail(&fifo,
(size_t)pool.mpool_base());
if( ((i+5)*(j+1)) != value.ivalue ) {
test_failure(" ompi_cb_fifo_read_from_tail\n");
error_cnt++;
}

Просмотреть файл

@ -28,15 +28,20 @@
#include "support.h"
#include "class/ompi_pointer_array.h"
typedef union {
int ivalue;
char *cvalue;
} value_t;
static void test(bool thread_usage){
/* local variables */
ompi_pointer_array_t *array;
char *test_value;
char **test_data;
value_t *test_data;
int len_test_data,i,test_len_in_array,error_cnt;
int ele_index;
int use_threads,error_code;
value_t value;
/* initialize thread levels */
use_threads=(int)ompi_set_using_threads(thread_usage);
@ -45,23 +50,21 @@ static void test(bool thread_usage){
assert(array);
len_test_data=5;
test_data=malloc(sizeof(char *)*len_test_data);
test_data=malloc(sizeof(value_t)*len_test_data);
assert(test_data);
for(i=0 ; i < len_test_data ; i++ ) {
test_data[i]=(char *)(i+1);
test_data[i].ivalue = (i+1);
}
/* add data to table */
test_len_in_array=3;
assert(len_test_data>=test_len_in_array);
for(i=0 ; i < test_len_in_array ; i++ ) {
ompi_pointer_array_add(array,test_data[i]);
ompi_pointer_array_add(array,test_data[i].cvalue);
}
/* check to see that test_len_in_array are in array */
if( (array->size - array->number_free) ==
test_len_in_array) {
if( (array->size - array->number_free) == test_len_in_array) {
test_success();
} else {
test_failure("check on number of elments in array");
@ -70,8 +73,10 @@ static void test(bool thread_usage){
/* check order of data */
error_cnt=0;
for(i=0 ; i < test_len_in_array ; i++ ) {
if( ((char *)(i+1)) != array->addr[i] )
value.cvalue = array->addr[i];
if( (i+1) != value.ivalue ) {
error_cnt++;
}
}
if( 0 == error_cnt ) {
test_success();
@ -107,7 +112,8 @@ static void test(bool thread_usage){
}
error_cnt=0;
for(i=0 ; i < array->size ; i++ ) {
ele_index=ompi_pointer_array_add(array,((char *)(i+2)) );
value.ivalue = i + 2;
ele_index=ompi_pointer_array_add(array, value.cvalue);
if( i != ele_index ) {
error_cnt++;
}
@ -120,8 +126,8 @@ static void test(bool thread_usage){
error_cnt=0;
for(i=0 ; i < array->size ; i++ ) {
test_value=ompi_pointer_array_get_item(array,i);
if( ((char *)(i+2)) != test_value ) {
value.cvalue = ompi_pointer_array_get_item(array,i);
if( (i+2) != value.ivalue ) {
error_cnt++;
}
}
@ -133,10 +139,9 @@ static void test(bool thread_usage){
free (array);
free(test_data);
return;
}
int main(int argc, char **argv)
{
test_init("ompi_pointer_array");