From e6c0fd17aa5c0ee9251ce1fd5c331a453f3446b5 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Tue, 5 Dec 2017 10:35:26 +0100 Subject: [PATCH] slightly augment this test (unlink) --- examples/s4u/io/s4u-io.cpp | 13 +++++++++---- examples/s4u/io/s4u-io.tesh | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/s4u/io/s4u-io.cpp b/examples/s4u/io/s4u-io.cpp index ac0ff0f708..7e6c110323 100644 --- a/examples/s4u/io/s4u-io.cpp +++ b/examples/s4u/io/s4u-io.cpp @@ -76,7 +76,15 @@ public: storage->setUserdata(new std::string("Some user data")); std::string* storage_data = static_cast(storage->getUserdata()); XBT_INFO(" Set and get data: '%s'", storage_data->c_str()); + delete storage_data; + + // Reopen the file and then unlink it + file = new simgrid::s4u::File("/home/tmp/simgrid.readme", nullptr); + XBT_INFO("Unlink file: '%s'", file->getPath()); + file->unlink(); + + show_info(mounts); } }; @@ -84,10 +92,7 @@ int main(int argc, char **argv) { simgrid::s4u::Engine e(&argc, argv); sg_storage_file_system_init(); - const char* platffile = "../../platforms/storage/storage.xml"; - if (argc > 1) - platffile = argv[1]; - e.loadPlatform(platffile); + e.loadPlatform(argv[1]); simgrid::s4u::Actor::createActor("host", simgrid::s4u::Host::by_name("denise"), MyHost()); e.run(); diff --git a/examples/s4u/io/s4u-io.tesh b/examples/s4u/io/s4u-io.tesh index f00cee29e3..1c3ae8bd5c 100644 --- a/examples/s4u/io/s4u-io.tesh +++ b/examples/s4u/io/s4u-io.tesh @@ -15,3 +15,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/s4u-io ${platfdir}/storage/storage.xml > [denise:host:(1) 0.006000] [s4u_test/INFO] Get/set data for storage element: Disk4 > [denise:host:(1) 0.006000] [s4u_test/INFO] Uninitialized storage data: '(null)' > [denise:host:(1) 0.006000] [s4u_test/INFO] Set and get data: 'Some user data' +> [denise:host:(1) 0.006000] [s4u_test/INFO] Unlink file: '/home/tmp/simgrid.readme' +> [denise:host:(1) 0.006000] [s4u_test/INFO] Storage info on denise: +> [denise:host:(1) 0.006000] [s4u_test/INFO] Disk2 (c:) Used: 2391537133; Free: 534479374867; Total: 536870912000. +> [denise:host:(1) 0.006000] [s4u_test/INFO] Disk4 (/home) Used: 13221994; Free: 536857690006; Total: 536870912000. -- 2.20.1