include teshsuite/mc/random-bug/random-bug.tesh
include teshsuite/msg/task_destroy_cancel/task_destroy_cancel.c
include teshsuite/msg/task_destroy_cancel/task_destroy_cancel.tesh
-include teshsuite/msg/task_listen_from/task_listen_from.c
-include teshsuite/msg/task_listen_from/task_listen_from.tesh
include teshsuite/python/borken-context/borken-context.py
include teshsuite/python/borken-context/borken-context.tesh
include teshsuite/python/borken-context/borken-context_d.xml
-foreach(x task_listen_from task_destroy_cancel)
- if(enable_msg)
- add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c)
- target_link_libraries(${x} simgrid)
- set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
- add_dependencies(tests ${x})
- endif()
-
- set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
- set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
-endforeach()
-
-set(teshsuite_src ${teshsuite_src} PARENT_SCOPE)
-set(tesh_files ${tesh_files} PARENT_SCOPE)
-
if(enable_msg)
- foreach(x task_destroy_cancel task_listen_from)
-
- ADD_TESH_FACTORIES(tesh-msg-${x} "raw" --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
- --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/${x}
- --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}
- ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh)
- endforeach()
+ add_executable (task_destroy_cancel EXCLUDE_FROM_ALL task_destroy_cancel/task_destroy_cancel.c)
+ target_link_libraries(task_destroy_cancel simgrid)
+ set_target_properties(task_destroy_cancel PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/task_destroy_cancel)
+ add_dependencies(tests task_destroy_cancel)
+
+ ADD_TESH_FACTORIES(tesh-msg-task_destroy_cancel "raw" --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+ --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/task_destroy_cancel
+ --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/task_destroy_cancel
+ ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.tesh)
endif()
+
+set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel/task_destroy_cancel.tesh PARENT_SCOPE)
+set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/task_destroy_cancel/task_destroy_cancel.c PARENT_SCOPE)
+++ /dev/null
-/* Copyright (c) 2017-2020. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-/* This is the test case of GitHub's #121 */
-
-#include "simgrid/msg.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-
-static int tester(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- msg_task_t task = MSG_task_create("name", 0, 10, NULL);
- const_msg_comm_t comm = MSG_task_isend(task, "mailbox");
-
- XBT_INFO("MSG_task_listen_from returns() %d (should return my pid, which is %d)", MSG_task_listen_from("mailbox"),
- MSG_process_get_PID(MSG_process_self()));
- XBT_INFO("MSG_task_listen returns() %d (should return true, i.e. 1)", MSG_task_listen("mailbox"));
-
- MSG_comm_destroy(comm);
- MSG_task_destroy(task);
-
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
- MSG_init(&argc, argv);
- xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
- MSG_create_environment(argv[1]);
-
- MSG_process_create("tester", tester, NULL, MSG_get_host_by_name("Tremblay"));
-
- return MSG_main();
-}
+++ /dev/null
-$ ${bindir}/task_listen_from ${platfdir}/small_platform.xml
-> [Tremblay:tester:(1) 0.000000] [msg_test/INFO] MSG_task_listen_from returns() 1 (should return my pid, which is 1)
-> [Tremblay:tester:(1) 0.000000] [msg_test/INFO] MSG_task_listen returns() 1 (should return true, i.e. 1)
xbt_assert(mailbox->listen()); // True (1)
XBT_INFO("Task listen works on regular mailboxes");
+ XBT_INFO("Mailbox::listen_from() returns %ld (should return my pid, which is %ld)", mailbox->listen_from(),
+ simgrid::s4u::this_actor::get_pid());
+
const std::string* res = static_cast<std::string*>(mailbox->get());
xbt_assert(*res == "Some data", "Data received: %s", res->c_str());
$ ./listen_async ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
> [ 0.000000] (test@Tremblay) Task listen works on regular mailboxes
+> [ 0.000000] (test@Tremblay) Mailbox::listen_from() returns 1 (should return my pid, which is 1)
> [ 0.000195] (test@Tremblay) Data successfully received from regular mailbox
> [ 0.000195] (test@Tremblay) Task listen works on asynchronous mailboxes
> [ 0.000195] (test@Tremblay) Data successfully received from asynchronous mailbox