A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Explain how to change compiler version on doc
[simgrid.git]
/
teshsuite
/
gras
/
datadesc
/
datadesc_usage.c
diff --git
a/teshsuite/gras/datadesc/datadesc_usage.c
b/teshsuite/gras/datadesc/datadesc_usage.c
index
ac8e05d
..
10a5e8b
100644
(file)
--- a/
teshsuite/gras/datadesc/datadesc_usage.c
+++ b/
teshsuite/gras/datadesc/datadesc_usage.c
@@
-59,7
+59,7
@@
static void test_int(gras_socket_t sock, int direction)
{
int i = 5, j;
-
INFO0
("---- Test on integer ----");
+
XBT_INFO
("---- Test on integer ----");
write_read("int", &i, &j, sock, direction);
if (direction == READ || direction == COPY)
xbt_assert(i == j);
@@
-69,20
+69,20
@@
static void test_float(gras_socket_t sock, int direction)
{
float i = 5.0, j;
-
INFO0
("---- Test on float ----");
+
XBT_INFO
("---- Test on float ----");
write_read("float", &i, &j, sock, direction);
if (direction == READ || direction == COPY)
- xbt_assert
2
(i == j, "%f != %f", i, j);
+ xbt_assert(i == j, "%f != %f", i, j);
}
static void test_double(gras_socket_t sock, int direction)
{
double i = -3252355.1234, j;
-
INFO0
("---- Test on double ----");
+
XBT_INFO
("---- Test on double ----");
write_read("double", &i, &j, sock, direction);
if (direction == READ || direction == COPY)
- xbt_assert
2
(i == j, "%f != %f", i, j);
+ xbt_assert(i == j, "%f != %f", i, j);
}
#define FIXED_ARRAY_SIZE 5
@@
-93,13
+93,13
@@
static void test_array(gras_socket_t sock, int direction)
array j;
int cpt;
-
INFO0
("---- Test on fixed array ----");
+
XBT_INFO
("---- Test on fixed array ----");
write_read("fixed int array", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
for (cpt = 0; cpt < FIXED_ARRAY_SIZE; cpt++) {
-
DEBUG1
("Test spot %d", cpt);
- xbt_assert
4
(i[cpt] == j[cpt], "i[%d]=%d != j[%d]=%d",
+
XBT_DEBUG
("Test spot %d", cpt);
+ xbt_assert(i[cpt] == j[cpt], "i[%d]=%d != j[%d]=%d",
cpt, i[cpt], cpt, j[cpt]);
}
}
@@
-112,11
+112,11
@@
static void test_dynar_scal(gras_socket_t sock, int direction)
xbt_dynar_t i, j;
int cpt;
-
INFO0
("---- Test on dynar containing integers ----");
+
XBT_INFO
("---- Test on dynar containing integers ----");
i = xbt_dynar_new(sizeof(int), NULL);
for (cpt = 0; cpt < 64; cpt++) {
xbt_dynar_push_as(i, int, cpt);
-
DEBUG2
("Push %d, length=%lu", cpt, xbt_dynar_length(i));
+
XBT_DEBUG
("Push %d, length=%lu", cpt, xbt_dynar_length(i));
}
/* xbt_dynar_dump(i); */
write_read("xbt_dynar_of_int", &i, &j, sock, direction);
@@
-125,9
+125,9
@@
static void test_dynar_scal(gras_socket_t sock, int direction)
for (cpt = 0; cpt < 64; cpt++) {
int ret = xbt_dynar_get_as(j, cpt, int);
if (cpt != ret) {
- CRITICAL3
- ("The retrieved value for cpt=%d is not the same than the injected one (%d!=%d)",
- cpt, ret, cpt);
+ XBT_CRITICAL
+
("The retrieved value for cpt=%d is not the same than the injected one (%d!=%d)",
+
cpt, ret, cpt);
xbt_abort();
}
}
@@
-142,7
+142,7
@@
static void test_dynar_empty(gras_socket_t sock, int direction)
{
xbt_dynar_t i, j;
-
INFO0
("---- Test on empty dynar of integers ----");
+
XBT_INFO
("---- Test on empty dynar of integers ----");
i = xbt_dynar_new(sizeof(int), NULL);
write_read("xbt_dynar_of_int", &i, &j, sock, direction);
/* xbt_dynar_dump(j); */
@@
-160,11
+160,11
@@
static void test_intref(gras_socket_t sock, int direction)
i = xbt_new(int, 1);
*i = 12345;
-
INFO0
("---- Test on a reference to an integer ----");
+
XBT_INFO
("---- Test on a reference to an integer ----");
write_read("int*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
- xbt_assert
2
(*i == *j, "*i != *j (%d != %d)", *i, *j);
+ xbt_assert(*i == *j, "*i != *j (%d != %d)", *i, *j);
free(j);
}
free(i);
@@
-178,11
+178,11
@@
static void test_string(gras_socket_t sock, int direction)
char *i = xbt_strdup("Some data"), *j = NULL;
int cpt;
-
INFO0
("---- Test on string (ref to dynamic array) ----");
+
XBT_INFO
("---- Test on string (ref to dynamic array) ----");
write_read("string", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
for (cpt = 0; cpt < strlen(i); cpt++) {
- xbt_assert
4
(i[cpt] == j[cpt], "i[%d]=%c != j[%d]=%c",
+ xbt_assert(i[cpt] == j[cpt], "i[%d]=%c != j[%d]=%c",
cpt, i[cpt], cpt, j[cpt]);
}
free(j);
@@
-201,7
+201,7
@@
static void test_homostruct(gras_socket_t sock, int direction)
{
homostruct *i, *j;
-
INFO0
("---- Test on homogeneous structure ----");
+
XBT_INFO
("---- Test on homogeneous structure ----");
/* init a value, exchange it and check its validity */
i = xbt_new(homostruct, 1);
i->a = 2235;
@@
-211,7
+211,7
@@
static void test_homostruct(gras_socket_t sock, int direction)
write_read("homostruct*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
- xbt_assert
2
(i->a == j->a, "i->a=%d != j->a=%d", i->a, j->a);
+ xbt_assert(i->a == j->a, "i->a=%d != j->a=%d", i->a, j->a);
xbt_assert(i->b == j->b);
xbt_assert(i->c == j->c);
xbt_assert(i->d == j->d);
@@
-233,7
+233,7
@@
static void test_hetestruct(gras_socket_t sock, int direction)
{
hetestruct *i, *j;
-
INFO0
("---- Test on heterogeneous structure ----");
+
XBT_INFO
("---- Test on heterogeneous structure ----");
/* init a value, exchange it and check its validity */
i = xbt_new(hetestruct, 1);
i->c1 = 's';
@@
-245,7
+245,8
@@
static void test_hetestruct(gras_socket_t sock, int direction)
if (direction == READ || direction == COPY) {
xbt_assert(i->c1 == j->c1);
xbt_assert(i->c2 == j->c2);
- xbt_assert2(i->l1 == j->l1, "i->l1(=%ld) != j->l1(=%ld)", i->l1, j->l1);
+ xbt_assert(i->l1 == j->l1, "i->l1(=%ld) != j->l1(=%ld)", i->l1,
+ j->l1);
xbt_assert(i->l2 == j->l2);
free(j);
}
@@
-257,7
+258,7
@@
static void test_hetestruct_array(gras_socket_t sock, int direction)
hetestruct *i, *j, *p, *q;
int cpt;
-
INFO0
("---- Test on heterogeneous structure arrays ----");
+
XBT_INFO
("---- Test on heterogeneous structure arrays ----");
/* init a value, exchange it and check its validity */
i = xbt_malloc(sizeof(hetestruct) * 10);
for (cpt = 0, p = i; cpt < 10; cpt++, p++) {
@@
-272,7
+273,7
@@
static void test_hetestruct_array(gras_socket_t sock, int direction)
for (cpt = 0, p = i, q = j; cpt < 10; cpt++, p++, q++) {
xbt_assert(p->c1 == q->c1);
xbt_assert(p->c2 == q->c2);
- xbt_assert
3
(p->l1 == p->l1,
+ xbt_assert(p->l1 == p->l1,
"for cpt=%d i->l1(=%ld) != j->l1(=%ld)", cpt, p->l1,
q->l1);
xbt_assert(q->l2 == p->l2);
@@
-293,7
+294,7
@@
static void test_nestedstruct(gras_socket_t sock, int direction)
{
nestedstruct *i, *j;
-
INFO0
("---- Test on nested structures ----");
+
XBT_INFO
("---- Test on nested structures ----");
/* init a value, exchange it and check its validity */
i = xbt_new(nestedstruct, 1);
i->homo.a = 235231;
@@
-363,7
+364,7
@@
static void test_chain_list(gras_socket_t sock, int direction)
{
chained_list_t *i, *j;
-
INFO0
("---- Test on chained list ----");
+
XBT_INFO
("---- Test on chained list ----");
/* init a value, exchange it and check its validity */
i = cons(12355, cons(246264, cons(23263, NULL)));
@@
-385,7
+386,7
@@
static void test_graph(gras_socket_t sock, int direction)
{
chained_list_t *i, *j;
-
INFO0
("---- Test on graph (cyclique chained list of 3 items) ----");
+
XBT_INFO
("---- Test on graph (cyclique chained list of 3 items) ----");
/* init a value, exchange it and check its validity */
i = cons(1151515, cons(-232362, cons(222552, NULL)));
i->l->l->l = i;
@@
-394,15
+395,15
@@
static void test_graph(gras_socket_t sock, int direction)
write_read("chained_list_t*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
-
DEBUG1
("i=%p", i);
-
DEBUG1
("i->l=%p", i->l);
-
DEBUG1
("i->l->l=%p", i->l->l);
-
DEBUG1
("i->l->l->l=%p", i->l->l->l);
-
DEBUG1
("j=%p", j);
-
DEBUG1
("j->l=%p", j->l);
-
DEBUG1
("j->l->l=%p", j->l->l);
-
DEBUG1
("j->l->l->l=%p", j->l->l->l);
- xbt_assert
4
(j->l->l->l == j,
+
XBT_DEBUG
("i=%p", i);
+
XBT_DEBUG
("i->l=%p", i->l);
+
XBT_DEBUG
("i->l->l=%p", i->l->l);
+
XBT_DEBUG
("i->l->l->l=%p", i->l->l->l);
+
XBT_DEBUG
("j=%p", j);
+
XBT_DEBUG
("j->l=%p", j->l);
+
XBT_DEBUG
("j->l->l=%p", j->l->l);
+
XBT_DEBUG
("j->l->l->l=%p", j->l->l->l);
+ xbt_assert(j->l->l->l == j,
"Received list is not cyclic. j=%p != j->l->l->l=%p\n"
"j=%p; &j=%p", j, j->l->l->l, j, &j);
j->l->l->l = NULL;
@@
-429,7
+430,7
@@
static void test_dynar_ref(gras_socket_t sock, int direction)
char *s1, *s2;
int cpt;
-
INFO0
("---- Test on dynar containing integers ----");
+
XBT_INFO
("---- Test on dynar containing integers ----");
i = xbt_dynar_new(sizeof(char *), &free_string);
for (cpt = 0; cpt < 64; cpt++) {
@@
-443,7
+444,7
@@
static void test_dynar_ref(gras_socket_t sock, int direction)
for (cpt = 0; cpt < 64; cpt++) {
sprintf(buf, "%d", cpt);
xbt_dynar_shift(j, &s2);
- xbt_assert
2
(!strcmp(buf, s2),
+ xbt_assert(!strcmp(buf, s2),
"The retrieved value is not the same than the injected one (%s!=%s)",
buf, s2);
free(s2);
@@
-456,25
+457,29
@@
static void test_dynar_ref(gras_socket_t sock, int direction)
/**** PBIO *****/
GRAS_DEFINE_TYPE(s_pbio, struct s_pbio { /* structure presented in the IEEE article */
- int Cnstatv; double Cstatev[12];
- int Cnprops;
- double Cprops[110]; int Cndi[4]; int Cnshr; int Cnpt;
- double Cdtime;
- double Ctime[2];
- int Cntens; double Cdfgrd0[373][3]; double Cdfgrd1[3][3];
- double Cstress[106]; double Cddsdde[106][106];};)
+ int Cnstatv;
+ double Cstatev[12]; int Cnprops; double Cprops[110];
+ int Cndi[4];
+ int Cnshr;
+ int Cnpt; double Cdtime; double Ctime[2]; int Cntens;
+ double Cdfgrd0[373][3];
+ double Cdfgrd1[3][3]; double Cstress[106];
+ double Cddsdde[106][106];
+ };
+
+ )
-
typedef struct s_pbio pbio_t;
+typedef struct s_pbio pbio_t;
-
static void test_pbio(gras_socket_t sock, int direction)
+static void test_pbio(gras_socket_t sock, int direction)
{
int cpt;
int cpt2;
gras_datadesc_type_t pbio_type;
pbio_t i, j;
- INFO0
- ("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
+ XBT_INFO
+
("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
pbio_type = gras_datadesc_by_symbol(s_pbio);
/* Fill in that damn struct */
@@
-509,7
+514,7
@@
GRAS_DEFINE_TYPE(s_pbio, struct s_pbio { /* structure presented in the IE
/* Check that the data match */
xbt_assert(i.Cnstatv == j.Cnstatv);
for (cpt = 0; cpt < 12; cpt++)
- xbt_assert
4
(i.Cstatev[cpt] == j.Cstatev[cpt],
+ xbt_assert(i.Cstatev[cpt] == j.Cstatev[cpt],
"i.Cstatev[%d] (=%f) != j.Cstatev[%d] (=%f)",
cpt, i.Cstatev[cpt], cpt, j.Cstatev[cpt]);
xbt_assert(i.Cnprops == j.Cnprops);
@@
-532,7
+537,7
@@
GRAS_DEFINE_TYPE(s_pbio, struct s_pbio { /* structure presented in the IE
for (cpt = 0; cpt < 106; cpt++) {
xbt_assert(i.Cstress[cpt] == j.Cstress[cpt]);
for (cpt2 = 0; cpt2 < 106; cpt2++)
- xbt_assert
4
(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
+ xbt_assert(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
"%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
i.Cddsdde[cpt][cpt2], cpt, cpt2, j.Cddsdde[cpt][cpt2]);
}
@@
-540,20
+545,19
@@
GRAS_DEFINE_TYPE(s_pbio, struct s_pbio { /* structure presented in the IE
}
GRAS_DEFINE_TYPE(s_clause, struct s_clause {
- int num_lits; int *literals GRAS_ANNOTE(size, num_lits); /* Tells GRAS where to find the size */
- };
-
- )
+ int num_lits;
+ int *literals GRAS_ANNOTE(size, num_lits); /* Tells GRAS where to find the size */
+ };)
-
typedef struct s_clause Clause;
+typedef struct s_clause Clause;
-
static void test_clause(gras_socket_t sock, int direction)
+static void test_clause(gras_socket_t sock, int direction)
{
Clause *i, *j;
int cpt;
- INFO0
- ("---- Test on struct containing dynamic array and its size (cbps test) ----");
+ XBT_INFO
+
("---- Test on struct containing dynamic array and its size (cbps test) ----");
/* create and fill the struct */
i = xbt_new(Clause, 1);
@@
-562,8
+566,8
@@
GRAS_DEFINE_TYPE(s_clause, struct s_clause {
i->literals = xbt_new(int, i->num_lits);
for (cpt = 0; cpt < i->num_lits; cpt++)
i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
-
DEBUG3
("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
-
DEBUG1
("created count=%d", i->num_lits);
+
XBT_DEBUG
("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
+
XBT_DEBUG
("created count=%d", i->num_lits);
write_read("Clause*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
@@
-582,16
+586,16
@@
static void test_clause_empty(gras_socket_t sock, int direction)
{
Clause *i, *j;
- INFO0
- ("---- Test on struct containing dynamic array and its size when size=0 (cbps test) ----");
+ XBT_INFO
+
("---- Test on struct containing dynamic array and its size when size=0 (cbps test) ----");
/* create and fill the struct */
i = xbt_new(Clause, 1);
i->num_lits = 0;
i->literals = NULL;
-
DEBUG3
("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
-
DEBUG1
("created count=%d", i->num_lits);
+
XBT_DEBUG
("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
+
XBT_DEBUG
("created count=%d", i->num_lits);
write_read("Clause*", &i, &j, sock, direction);
if (direction == READ || direction == COPY) {
@@
-634,7
+638,8
@@
static void register_types(void)
gras_datadesc_struct_append(my_type, "d", gras_datadesc_by_name("int"));
gras_datadesc_struct_close(my_type);
my_type =
- gras_datadesc_ref("homostruct*", gras_datadesc_by_name("homostruct"));
+ gras_datadesc_ref("homostruct*",
+ gras_datadesc_by_name("homostruct"));
gras_msgtype_declare("homostruct*", my_type);
my_type = gras_datadesc_struct("hetestruct");
@@
-648,12
+653,13
@@
static void register_types(void)
gras_datadesc_by_name("unsigned long int"));
gras_datadesc_struct_close(my_type);
my_type =
- gras_datadesc_ref("hetestruct*", gras_datadesc_by_name("hetestruct"));
+ gras_datadesc_ref("hetestruct*",
+ gras_datadesc_by_name("hetestruct"));
gras_msgtype_declare("hetestruct*", my_type);
my_type =
- gras_datadesc_array_fixed("hetestruct[10]",
- gras_datadesc_by_name("hetestruct"), 10);
+
gras_datadesc_array_fixed("hetestruct[10]",
+
gras_datadesc_by_name("hetestruct"), 10);
my_type = gras_datadesc_ref("hetestruct[10]*", my_type);
gras_msgtype_declare("hetestruct[10]*", my_type);
@@
-664,7
+670,8
@@
static void register_types(void)
gras_datadesc_by_name("homostruct"));
gras_datadesc_struct_close(my_type);
my_type =
- gras_datadesc_ref("nestedstruct*", gras_datadesc_by_name("nestedstruct"));
+ gras_datadesc_ref("nestedstruct*",
+ gras_datadesc_by_name("nestedstruct"));
gras_msgtype_declare("nestedstruct*", my_type);
my_type = gras_datadesc_struct("chained_list_t");
@@
-677,7
+684,7
@@
static void register_types(void)
gras_msgtype_declare("chained_list_t*", ref_my_type);
my_type =
- gras_datadesc_dynar(gras_datadesc_by_name("string"), &free_string);
+
gras_datadesc_dynar(gras_datadesc_by_name("string"), &free_string);
gras_msgtype_declare("xbt_dynar_of_string", my_type);
my_type = gras_datadesc_by_symbol(s_pbio);
@@
-706,7
+713,7
@@
int main(int argc, char *argv[])
for (cpt = 1; cpt < argc; cpt++) {
if (!strcmp(argv[cpt], "--arch")) {
-
INFO2
("We are on %s (#%d)",
+
XBT_INFO
("We are on %s (#%d)",
gras_datadesc_arch_name(gras_arch_selfid()),
(int) gras_arch_selfid());
exit(0);
@@
-717,13
+724,14
@@
int main(int argc, char *argv[])
printf(" --write file: writes the description to the given file\n");
printf(" --copy: copy the description in memory\n");
printf
- (" --regen: write the description to the file of the current architecture\n");
+
(" --regen: write the description to the file of the current architecture\n");
printf(" --help: displays this message\n");
exit(0);
} else if (!strcmp(argv[cpt], "--regen")) {
direction = WRITE;
filename =
- bprintf("datadesc.%s", gras_datadesc_arch_name(gras_arch_selfid()));
+ bprintf("datadesc.%s",
+ gras_datadesc_arch_name(gras_arch_selfid()));
} else if (!strcmp(argv[cpt], "--read")) {
direction = READ;
} else if (!strcmp(argv[cpt], "--write")) {
@@
-736,21
+744,23
@@
int main(int argc, char *argv[])
}
if (direction == WRITE) {
- INFO1("Write to file %s", strrchr(filename,'/')?strrchr(filename,'/')+1:filename);
+ XBT_INFO("Write to file %s",
+ strrchr(filename, '/') ? strrchr(filename, '/') + 1 : filename);
sock = gras_socket_client_from_file(filename);
}
if (direction == READ) {
- INFO1("Read from file %s", strrchr(filename,'/')?strrchr(filename,'/')+1:filename);
+ XBT_INFO("Read from file %s",
+ strrchr(filename, '/') ? strrchr(filename, '/') + 1 : filename);
sock = gras_socket_server_from_file(filename);
}
if (direction == COPY) {
-
INFO0
("Memory copy");
+
XBT_INFO
("Memory copy");
}
local_arch = gras_arch_selfid();
write_read("char", &local_arch, &remote_arch, sock, direction);
if (direction == READ)
-
VERB2
("This file was generated on %s (%d)",
+
XBT_VERB
("This file was generated on %s (%d)",
gras_datadesc_arch_name(remote_arch), (int) remote_arch);