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
merging tracing changes
[simgrid.git]
/
teshsuite
/
gras
/
msg_handle
/
msg_handle.c
diff --git
a/teshsuite/gras/msg_handle/msg_handle.c
b/teshsuite/gras/msg_handle/msg_handle.c
index
678115b
..
dcc37ce
100644
(file)
--- a/
teshsuite/gras/msg_handle/msg_handle.c
+++ b/
teshsuite/gras/msg_handle/msg_handle.c
@@
-16,9
+16,10
@@
XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific to this test");
int server(int argc, char *argv[]);
int client(int argc, char *argv[]);
int server(int argc, char *argv[]);
int client(int argc, char *argv[]);
-static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
+static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx,
+ void *payload_data)
{
{
-
INFO0
("Got the message");
+
XBT_INFO
("Got the message");
return 0;
}
return 0;
}
@@
-35,26
+36,26
@@
int server(int argc, char *argv[])
gras_init(&argc, argv);
gras_init(&argc, argv);
- xbt_assert
0
(argc == 3, "Usage: server <myport> <client>");
+ xbt_assert(argc == 3, "Usage: server <myport> <client>");
myport = atoi(argv[1]);
palstr = argv[2];
gras_msgtype_declare("hello", NULL);
gras_cb_register("hello", &server_cb_hello_handler);
myport = atoi(argv[1]);
palstr = argv[2];
gras_msgtype_declare("hello", NULL);
gras_cb_register("hello", &server_cb_hello_handler);
-
INFO1
("Launch server (port=%d)", myport);
+
XBT_INFO
("Launch server (port=%d)", myport);
TRY {
me = gras_socket_server(myport);
} CATCH(e) {
TRY {
me = gras_socket_server(myport);
} CATCH(e) {
- RETHROW
0
("Unable to establish a server socket: %s");
+ RETHROW
F
("Unable to establish a server socket: %s");
}
gras_os_sleep(1); /* Wait for pal to startup */
TRY {
pal = gras_socket_client_from_string(palstr);
} CATCH(e) {
}
gras_os_sleep(1); /* Wait for pal to startup */
TRY {
pal = gras_socket_client_from_string(palstr);
} CATCH(e) {
- RETHROW
1
("Unable to establish a socket to %s: %s", palstr);
+ RETHROW
F
("Unable to establish a socket to %s: %s", palstr);
}
}
-
INFO0
("Initialization done.");
+
XBT_INFO
("Initialization done.");
now = gras_os_time();
/* Launch handle(0) when there is no message. Timeout expected */
now = gras_os_time();
/* Launch handle(0) when there is no message. Timeout expected */
@@
-66,15
+67,15
@@
int server(int argc, char *argv[])
got_expected = 1;
xbt_ex_free(e);
} else {
got_expected = 1;
xbt_ex_free(e);
} else {
- RETHROW
0
("Didn't got the expected timeout: %s");
+ RETHROW
F
("Didn't got the expected timeout: %s");
}
}
}
}
- xbt_assert
0
(got_expected,
+ xbt_assert(got_expected,
"gras_msg_handle(0) do not lead to any timeout exception");
"gras_msg_handle(0) do not lead to any timeout exception");
- xbt_assert
1
(gras_os_time() - now < 0.01,
+ xbt_assert(gras_os_time() - now < 0.01,
"gras_msg_handle(0) do not anwser immediately (%.4fsec)",
gras_os_time() - now);
"gras_msg_handle(0) do not anwser immediately (%.4fsec)",
gras_os_time() - now);
-
INFO0
("gras_msg_handle(0) works as expected (immediate timeout)");
+
XBT_INFO
("gras_msg_handle(0) works as expected (immediate timeout)");
/* Launch handle(0) when there is no message. Timeout expected */
got_expected = 0;
TRY {
/* Launch handle(0) when there is no message. Timeout expected */
got_expected = 0;
TRY {
@@
-85,22
+86,22
@@
int server(int argc, char *argv[])
got_expected = 1;
xbt_ex_free(e);
} else {
got_expected = 1;
xbt_ex_free(e);
} else {
- RETHROW
0
("Didn't got the expected timeout: %s");
+ RETHROW
F
("Didn't got the expected timeout: %s");
}
}
}
}
- xbt_assert
0
(got_expected,
+ xbt_assert(got_expected,
"gras_msg_handle(1) do not lead to any timeout exception");
"gras_msg_handle(1) do not lead to any timeout exception");
- xbt_assert
1
(gras_os_time() - now < 1.5,
+ xbt_assert(gras_os_time() - now < 1.5,
"gras_msg_handle(1) needs more than 1.5 sec to answer (%.4fsec)",
gras_os_time() - now);
"gras_msg_handle(1) needs more than 1.5 sec to answer (%.4fsec)",
gras_os_time() - now);
- xbt_assert
1
(gras_os_time() - now >= 1.0,
+ xbt_assert(gras_os_time() - now >= 1.0,
"gras_msg_handle(1) answers in less than one second (%.4fsec)",
gras_os_time() - now);
"gras_msg_handle(1) answers in less than one second (%.4fsec)",
gras_os_time() - now);
-
INFO0
("gras_msg_handle(1) works as expected (delayed timeout)");
+
XBT_INFO
("gras_msg_handle(1) works as expected (delayed timeout)");
gras_os_sleep(3);
/* Send an hello to the client to unlock it */
gras_os_sleep(3);
/* Send an hello to the client to unlock it */
-
INFO0
("Unlock pal");
+
XBT_INFO
("Unlock pal");
gras_msg_send(pal, "hello", NULL);
/* Frees the allocated resources, and shut GRAS down */
gras_msg_send(pal, "hello", NULL);
/* Frees the allocated resources, and shut GRAS down */
@@
-121,35
+122,35
@@
int client(int argc, char *argv[])
gras_init(&argc, argv);
gras_init(&argc, argv);
- xbt_assert
0
(argc == 3, "Usage: client <myport> <server>");
+ xbt_assert(argc == 3, "Usage: client <myport> <server>");
myport = atoi(argv[1]);
palstr = argv[2];
gras_msgtype_declare("hello", NULL);
gras_cb_register("hello", &server_cb_hello_handler);
myport = atoi(argv[1]);
palstr = argv[2];
gras_msgtype_declare("hello", NULL);
gras_cb_register("hello", &server_cb_hello_handler);
-
INFO1
("Launch client (port=%d)", myport);
+
XBT_INFO
("Launch client (port=%d)", myport);
TRY {
me = gras_socket_server(myport);
} CATCH(e) {
TRY {
me = gras_socket_server(myport);
} CATCH(e) {
- RETHROW
0
("Unable to establish a server socket: %s");
+ RETHROW
F
("Unable to establish a server socket: %s");
}
gras_os_sleep(1); /* Wait for pal to startup */
TRY {
pal = gras_socket_client_from_string(palstr);
} CATCH(e) {
}
gras_os_sleep(1); /* Wait for pal to startup */
TRY {
pal = gras_socket_client_from_string(palstr);
} CATCH(e) {
- RETHROW
1
("Unable to establish a socket to %s: %s", palstr);
+ RETHROW
F
("Unable to establish a socket to %s: %s", palstr);
}
}
-
INFO0
("Initialization done.");
+
XBT_INFO
("Initialization done.");
/* Launch handle(-1). Lock until message from server expected */
got_expected = 0;
TRY {
gras_msg_handle(-1);
} CATCH(e) {
/* Launch handle(-1). Lock until message from server expected */
got_expected = 0;
TRY {
gras_msg_handle(-1);
} CATCH(e) {
- RETHROW
0
("No exception expected during handle(-1), but got %s");
+ RETHROW
F
("No exception expected during handle(-1), but got %s");
}
}
-
INFO0
("gras_msg_handle(-1) works as expected (locked)");
+
XBT_INFO
("gras_msg_handle(-1) works as expected (locked)");
/* Frees the allocated resources, and shut GRAS down */
gras_socket_close(me);
/* Frees the allocated resources, and shut GRAS down */
gras_socket_close(me);