diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-23 11:45:30 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-23 11:48:50 +0100 |
commit | 2da2b82dce0f6ebdc7f9d27a5815cdcba77abaab (patch) | |
tree | b1d6992895693624564cc05161f8347828311c98 /storage/src/tests/visiting/visitortest.cpp | |
parent | 8372a883c5a5fa100f88fc9b80824359b5bb70cd (diff) |
Reduce use of system() in storage unit tests.
Diffstat (limited to 'storage/src/tests/visiting/visitortest.cpp')
-rw-r--r-- | storage/src/tests/visiting/visitortest.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 46b0f4d830d..51ce1c11e55 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -16,8 +16,10 @@ #include <vespa/documentapi/messagebus/messages/putdocumentmessage.h> #include <vespa/documentapi/messagebus/messages/removedocumentmessage.h> #include <vespa/documentapi/messagebus/messages/visitor.h> +#include <vespa/vespalib/io/fileutil.h> #include <vespa/config/common/exceptions.h> #include <thread> +#include <sys/stat.h> using namespace std::chrono_literals; using document::test::makeBucketSpace; @@ -185,10 +187,10 @@ VisitorTest::initializeTest(const TestParams& params) std::string rootFolder = getRootFolder(config); - system(vespalib::make_string("chmod 755 %s 2>/dev/null", rootFolder.c_str()).c_str()); - system(vespalib::make_string("rm -rf %s* 2>/dev/null", rootFolder.c_str()).c_str()); - assert(system(vespalib::make_string("mkdir -p %s/disks/d0", rootFolder.c_str()).c_str()) == 0); - assert(system(vespalib::make_string("mkdir -p %s/disks/d1", rootFolder.c_str()).c_str()) == 0); + ::chmod(rootFolder.c_str(), 0755); + vespalib::rmdir(rootFolder, true); + vespalib::mkdir(vespalib::make_string("%s/disks/d0", rootFolder.c_str()), true); + vespalib::mkdir(vespalib::make_string("%s/disks/d1", rootFolder.c_str()), true); try { _messageSessionFactory.reset( |