Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix dependency issue to prevent problems with make -jx
[simgrid.git] / teshsuite / msg / task_listen_from / task_listen_from.cpp
1 /* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 /* This is the test case of GitHub's #121 */
7
8 #include "simgrid/msg.h"
9
10 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
11
12 static int tester(int argc, char* argv[])
13 {
14   msg_task_t task = MSG_task_create("name", 0, 10, NULL);
15   msg_comm_t comm = MSG_task_isend(task, "mailbox");
16
17   XBT_INFO("MSG_task_listen_from returns() %d (should return my pid, which is %d)", MSG_task_listen_from("mailbox"),
18            MSG_process_get_PID(MSG_process_self()));
19   XBT_INFO("MSG_task_listen returns()      %d (should return true, i.e. 1)", MSG_task_listen("mailbox"));
20
21   MSG_comm_destroy(comm);
22   MSG_task_destroy(task);
23
24   return 0;
25 }
26
27 int main(int argc, char* argv[])
28 {
29   MSG_init(&argc, argv);
30   xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
31   MSG_create_environment(argv[1]);
32
33   MSG_process_create("tester", tester, NULL, MSG_get_host_by_name("Tremblay"));
34
35   return MSG_main();
36 }