Work around timing bug in OS X test cases

This commit is contained in:
Sebastian Messmer 2016-02-14 01:18:19 +01:00
parent 33c950e978
commit fcf817fbdd
2 changed files with 7 additions and 3 deletions

View File

@ -777,18 +777,18 @@ int Fuse::fsyncdir(const bf::path &path, int datasync, fuse_file_info *fileinfo)
void Fuse::init(fuse_conn_info *conn) { void Fuse::init(fuse_conn_info *conn) {
UNUSED(conn); UNUSED(conn);
LOG(INFO) << "Filesystem started.";
_running = true; _running = true;
#ifdef FSPP_LOG #ifdef FSPP_LOG
cpputils::logging::setLevel(DEBUG); cpputils::logging::setLevel(DEBUG);
#endif #endif
LOG(INFO) << "Filesystem started.";
} }
void Fuse::destroy() { void Fuse::destroy() {
_running = false;
LOG(INFO) << "Filesystem stopped."; LOG(INFO) << "Filesystem stopped.";
_running = false;
} }
int Fuse::access(const bf::path &path, int mask) { int Fuse::access(const bf::path &path, int mask) {

View File

@ -22,6 +22,10 @@ void FuseThread::start(int argc, char *argv[]) {
}); });
//Wait until it is running (busy waiting is simple and doesn't hurt much here) //Wait until it is running (busy waiting is simple and doesn't hurt much here)
while(!_fuse->running()) {} while(!_fuse->running()) {}
#ifdef __APPLE__
// On Mac OS X, _fuse->running() returns true too early, because osxfuse calls init() when it's not ready yet. Give it a bit time.
std::this_thread::sleep_for(std::chrono::milliseconds(200));
#endif
} }
void FuseThread::stop() { void FuseThread::stop() {