From: Frederic Suter Date: Thu, 23 Nov 2017 15:18:16 +0000 (+0100) Subject: revise this test to access storage directly X-Git-Tag: v3.18~251^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/926f31504062e8af5960555834671fae6b02087a?hp=-c revise this test to access storage directly --- 926f31504062e8af5960555834671fae6b02087a diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp index d079d3d470..0c1db3c605 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp @@ -4,44 +4,32 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/s4u.hpp" -#include - -#define FILENAME1 "/home/doc/simgrid/examples/platforms/g5k.xml" XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test"); static void host() { - char name[2048]; + simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName("Disk1"); int id = simgrid::s4u::this_actor::getPid(); - snprintf(name, 2048, "%s%i", FILENAME1, id); - simgrid::s4u::File* file = new simgrid::s4u::File(name, NULL); XBT_INFO("process %d is writing!", id); - file->write(3000000); + storage->write(3000000); XBT_INFO("process %d goes to sleep for %d seconds", id, id); simgrid::s4u::this_actor::sleep_for(id); XBT_INFO("process %d is writing again!", id); - file->write(3000000); + storage->write(3000000); XBT_INFO("process %d goes to sleep for %d seconds", id, 6 - id); simgrid::s4u::this_actor::sleep_for(6 - id); XBT_INFO("process %d is reading!", id); - file->seek(0); - file->read(3000000); + storage->read(3000000); XBT_INFO("process %d goes to sleep for %d seconds", id, id); simgrid::s4u::this_actor::sleep_for(id); XBT_INFO("process %d is reading again!", id); - file->seek(0); - file->read(3000000); - - XBT_INFO("process %d => Size of %s: %llu", id, name, file->size()); - // Close the file - delete file; + storage->read(3000000); } int main(int argc, char** argv) { simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv); - sg_storage_file_system_init(); e->loadPlatform(argv[1]); for (int i = 0; i < 5; i++) diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh b/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh index 6e2576aa2f..1d46abeb7b 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.tesh @@ -30,13 +30,8 @@ $ ./concurrent_rw$EXEEXT ${srcdir:=.}/../../../examples/platforms/storage/storag > [ 6.750000] (host@bob) process 4 goes to sleep for 4 seconds > [ 6.750000] (host@bob) process 5 goes to sleep for 5 seconds > [ 7.750000] (host@bob) process 1 is reading again! -> [ 7.780000] (host@bob) process 1 => Size of /home/doc/simgrid/examples/platforms/g5k.xml1: 6000000 > [ 8.750000] (host@bob) process 2 is reading again! -> [ 8.780000] (host@bob) process 2 => Size of /home/doc/simgrid/examples/platforms/g5k.xml2: 6000000 > [ 9.750000] (host@bob) process 3 is reading again! -> [ 9.780000] (host@bob) process 3 => Size of /home/doc/simgrid/examples/platforms/g5k.xml3: 6000000 > [ 10.750000] (host@bob) process 4 is reading again! -> [ 10.780000] (host@bob) process 4 => Size of /home/doc/simgrid/examples/platforms/g5k.xml4: 6000000 > [ 11.750000] (host@bob) process 5 is reading again! -> [ 11.780000] (host@bob) process 5 => Size of /home/doc/simgrid/examples/platforms/g5k.xml5: 6000000 > [ 11.780000] (maestro@) Simulation time 11.78