From 92c224ea97ba004a78199578a794111899cbd462 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Mon, 30 Mar 2020 15:18:55 +0200 Subject: [PATCH] use listen_from in s4u test and kill the MSG one --- MANIFEST.in | 2 -- teshsuite/msg/CMakeLists.txt | 34 +++++++----------- .../msg/task_listen_from/task_listen_from.c | 36 ------------------- .../task_listen_from/task_listen_from.tesh | 3 -- teshsuite/s4u/listen_async/listen_async.cpp | 3 ++ teshsuite/s4u/listen_async/listen_async.tesh | 1 + 6 files changed, 16 insertions(+), 63 deletions(-) delete mode 100644 teshsuite/msg/task_listen_from/task_listen_from.c delete mode 100644 teshsuite/msg/task_listen_from/task_listen_from.tesh diff --git a/MANIFEST.in b/MANIFEST.in index c5d7fa8c64..903dc9be71 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -662,8 +662,6 @@ include teshsuite/mc/random-bug/random-bug.cpp 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 diff --git a/teshsuite/msg/CMakeLists.txt b/teshsuite/msg/CMakeLists.txt index 765e69cf3d..7ceb0265dc 100644 --- a/teshsuite/msg/CMakeLists.txt +++ b/teshsuite/msg/CMakeLists.txt @@ -1,24 +1,14 @@ -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) diff --git a/teshsuite/msg/task_listen_from/task_listen_from.c b/teshsuite/msg/task_listen_from/task_listen_from.c deleted file mode 100644 index 87dab4fe76..0000000000 --- a/teshsuite/msg/task_listen_from/task_listen_from.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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(); -} diff --git a/teshsuite/msg/task_listen_from/task_listen_from.tesh b/teshsuite/msg/task_listen_from/task_listen_from.tesh deleted file mode 100644 index 6033f4035c..0000000000 --- a/teshsuite/msg/task_listen_from/task_listen_from.tesh +++ /dev/null @@ -1,3 +0,0 @@ -$ ${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) diff --git a/teshsuite/s4u/listen_async/listen_async.cpp b/teshsuite/s4u/listen_async/listen_async.cpp index 8002e01f47..e277a3df8d 100644 --- a/teshsuite/s4u/listen_async/listen_async.cpp +++ b/teshsuite/s4u/listen_async/listen_async.cpp @@ -21,6 +21,9 @@ static void server() 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(mailbox->get()); xbt_assert(*res == "Some data", "Data received: %s", res->c_str()); diff --git a/teshsuite/s4u/listen_async/listen_async.tesh b/teshsuite/s4u/listen_async/listen_async.tesh index d196f6e7a2..9d3157c18f 100644 --- a/teshsuite/s4u/listen_async/listen_async.tesh +++ b/teshsuite/s4u/listen_async/listen_async.tesh @@ -1,5 +1,6 @@ $ ./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 -- 2.20.1