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
In READ and WRITE mode (instead of RW), the remote_arch is the first char of the...
[simgrid.git]
/
testsuite
/
gras
/
datadesc_usage.c
diff --git
a/testsuite/gras/datadesc_usage.c
b/testsuite/gras/datadesc_usage.c
index
f09b5d9
..
e25b677
100644
(file)
--- a/
testsuite/gras/datadesc_usage.c
+++ b/
testsuite/gras/datadesc_usage.c
@@
-18,6
+18,9
@@
GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
#define WRITE 1
#define RW 2
#define WRITE 1
#define RW 2
+int r_arch;
+
+
gras_error_t
write_read(gras_datadesc_type_t *type,void *src, void *dst,
gras_socket_t *sock, int direction);
gras_error_t
write_read(gras_datadesc_type_t *type,void *src, void *dst,
gras_socket_t *sock, int direction);
@@
-33,17
+36,17
@@
write_read(gras_datadesc_type_t *type,void *src, void *dst,
if (direction == WRITE || direction == RW)
TRY(gras_datadesc_send(sock, type, src));
if (direction == RW)
if (direction == WRITE || direction == RW)
TRY(gras_datadesc_send(sock, type, src));
if (direction == RW)
- gras_socket_close(
&
sock);
+ gras_socket_close(sock);
/* read */
if (direction == RW)
TRY(gras_socket_server_from_file("datadesc_usage.out",&sock));
if (direction == READ || direction == RW)
/* read */
if (direction == RW)
TRY(gras_socket_server_from_file("datadesc_usage.out",&sock));
if (direction == READ || direction == RW)
- TRY(gras_datadesc_recv(sock, type,
gras_arch_selfid()
, dst));
+ TRY(gras_datadesc_recv(sock, type,
r_arch
, dst));
if (direction == RW)
if (direction == RW)
- gras_socket_close(
&
sock);
+ gras_socket_close(sock);
return no_error;
}
return no_error;
}
@@
-136,20
+139,14
@@
gras_error_t test_intref(gras_socket_t *sock, int direction) {
***/
gras_error_t test_string(gras_socket_t *sock, int direction) {
gras_error_t errcode;
***/
gras_error_t test_string(gras_socket_t *sock, int direction) {
gras_error_t errcode;
- gras_datadesc_type_t *my_type;
char *i=strdup("Some data"), *j=NULL;
int cpt;
char *i=strdup("Some data"), *j=NULL;
int cpt;
- INFO0("==== Test on string (dynamic array) ====");
- TRY(gras_datadesc_declare_ref("string*",
- gras_datadesc_by_name("string"),
- &my_type));
-
- TRY(write_read(gras_datadesc_by_name("string*"), &i,&j,
+ INFO0("==== Test on string (ref to dynamic array) ====");
+ TRY(write_read(gras_datadesc_by_name("string"), &i,&j,
sock,direction));
if (direction == READ || direction == RW) {
for (cpt=0; cpt<strlen(i); cpt++) {
sock,direction));
if (direction == READ || direction == RW) {
for (cpt=0; cpt<strlen(i); cpt++) {
- fprintf(stderr,"%d ", cpt);
gras_assert4(i[cpt] == j[cpt],"i[%d]=%c != j[%d]=%c",
cpt,i[cpt],cpt,j[cpt]);
}
gras_assert4(i[cpt] == j[cpt],"i[%d]=%c != j[%d]=%c",
cpt,i[cpt],cpt,j[cpt]);
}
@@
-397,12
+394,13
@@
gras_error_t test_graph(gras_socket_t *sock, int direction) {
"j=%p; &j=%p",
j,j->l->l->l,
j ,&j);
"j=%p; &j=%p",
j,j->l->l->l,
j ,&j);
- i->l->l->l = NULL;
j->l->l->l = NULL;
j->l->l->l = NULL;
+ i->l->l->l = NULL;
gras_assert(list_eq(i,j));
list_free(j);
}
gras_assert(list_eq(i,j));
list_free(j);
}
+ i->l->l->l = NULL; /* do this even in READ mode */
list_free(i);
return no_error;
}
list_free(i);
return no_error;
}
@@
-422,7
+420,8
@@
typedef struct { /* structure presented in the IEEE article */
int main(int argc,char *argv[]) {
gras_error_t errcode;
gras_socket_t *sock;
int main(int argc,char *argv[]) {
gras_error_t errcode;
gras_socket_t *sock;
- int direction = RW; // READ; // WRITE
+ int direction = RW;
+ char r_arch_char = gras_arch_selfid();
gras_init_defaultlog(&argc,argv,
"DataDesc.thresh=verbose"
gras_init_defaultlog(&argc,argv,
"DataDesc.thresh=verbose"
@@
-436,16
+435,25
@@
int main(int argc,char *argv[]) {
direction = WRITE;
}
direction = WRITE;
}
- if (direction == WRITE)
+ if (direction == WRITE)
{
TRYFAIL(gras_socket_client_from_file("datadesc_usage.out",&sock));
TRYFAIL(gras_socket_client_from_file("datadesc_usage.out",&sock));
- if (direction == READ)
+ TRY(gras_datadesc_send(sock, gras_datadesc_by_name("char"),
+ &r_arch_char));
+ }
+ if (direction == READ) {
TRYFAIL(gras_socket_server_from_file("datadesc_usage.out",&sock));
TRYFAIL(gras_socket_server_from_file("datadesc_usage.out",&sock));
-
+ TRY(gras_datadesc_recv(sock, gras_datadesc_by_name("char"),
+ gras_arch_selfid(), &r_arch_char));
+ INFO1("This datafile was generated on %s",
+ gras_datadesc_arch_name(r_arch_char));
+ }
+ r_arch = (int)r_arch_char;
+
TRYFAIL(test_int(sock,direction));
TRYFAIL(test_float(sock,direction));
TRYFAIL(test_array(sock,direction));
TRYFAIL(test_intref(sock,direction));
TRYFAIL(test_int(sock,direction));
TRYFAIL(test_float(sock,direction));
TRYFAIL(test_array(sock,direction));
TRYFAIL(test_intref(sock,direction));
-
+
TRYFAIL(test_string(sock,direction));
TRYFAIL(test_homostruct(sock,direction));
TRYFAIL(test_string(sock,direction));
TRYFAIL(test_homostruct(sock,direction));
@@
-457,7
+465,8
@@
int main(int argc,char *argv[]) {
TRYFAIL(test_graph(sock,direction));
if (direction != RW)
TRYFAIL(test_graph(sock,direction));
if (direction != RW)
- gras_socket_close(
&
sock);
+ gras_socket_close(sock);
gras_exit();
return 0;
}
gras_exit();
return 0;
}
+