From: Xing Lin Date: Thu, 28 Nov 2013 05:20:45 +0000 (-0700) Subject: test/filestore: add check of return values in StoreTest::SetUp X-Git-Tag: v0.74~36^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de09778561682eae8d33201ce1a77150b44ece53;p=ceph.git test/filestore: add check of return values in StoreTest::SetUp add return value check for function calls, including mkdir, mkfs and mount Signed-off-by: Xing Lin test/filestore: fix return value check for mkdir allow EEXIST from mkdir() Signed-off-by: Xing Lin --- diff --git a/src/test/filestore/store_test.cc b/src/test/filestore/store_test.cc index 50450f467ff0..89c0f51ff215 100644 --- a/src/test/filestore/store_test.cc +++ b/src/test/filestore/store_test.cc @@ -23,6 +23,7 @@ #include "global/global_init.h" #include "common/Mutex.h" #include "common/Cond.h" +#include "common/errno.h" #include #include #include @@ -39,11 +40,17 @@ public: StoreTest() : store(0) {} virtual void SetUp() { - ::mkdir("store_test_temp_dir", 0777); + int r = ::mkdir("store_test_temp_dir", 0777); + if (r < 0 && errno != EEXIST) { + r = -errno; + cerr << __func__ << ": unable to create store_test_temp_dir" << ": " << cpp_strerror(r) << std::endl; + return; + } + ObjectStore *store_ = new FileStore(string("store_test_temp_dir"), string("store_test_temp_journal")); store.reset(store_); - store->mkfs(); - store->mount(); + EXPECT_EQ(store->mkfs(), 0); + EXPECT_EQ(store->mount(), 0); } virtual void TearDown() {