TEST_F(SCOCacheConstructorTest, invalidMountPoint)
{
    MountPointConfigs mpCfgs;

    EXPECT_FALSE(fs::exists(pathPfx_ / "lost+found"));
    EXPECT_FALSE(fs::exists(pathPfx_ / "tooSmall"));
    EXPECT_FALSE(fs::exists(pathPfx_ / "one"));
    EXPECT_FALSE(fs::exists(pathPfx_ / "two"));

    mpCfgs.push_back(MountPointConfig(pathPfx_ / "lost+found", 1 << 30));
    mpCfgs.push_back(MountPointConfig(pathPfx_ / "tooSmall", 0));

    fs::path one(pathPfx_ / "one");
    fs::path two(pathPfx_ / "two");

    fs::create_directories(one);
    fs::create_directories(two);

    mpCfgs.push_back(MountPointConfig(one, 1ULL << 20));
    mpCfgs.push_back(MountPointConfig(two,
                                      std::numeric_limits<uint64_t>::max()));

    std::unique_ptr<SCOCache> scoCache;

    boost::property_tree::ptree pt;

    PARAMETER_TYPE(datastore_throttle_usecs)(throttling).persist(pt);
    PARAMETER_TYPE(trigger_gap)(yt::DimensionedValue(5ULL << 30)).persist(pt);
    PARAMETER_TYPE(backoff_gap)(yt::DimensionedValue(10ULL << 30)).persist(pt);
    pt.put("version", 1);
    PARAMETER_TYPE(scocache_mount_points)(mpCfgs).persist(pt);


    ASSERT_NO_THROW(scoCache.reset(new SCOCache(pt)));

    // EXPECT_TRUE(fs::exists(pathPfx_ / "one"));
    // EXPECT_TRUE(fs::exists(pathPfx_ / "two"));
    // EXPECT_FALSE(fs::exists(pathPfx_ / "tooSmall"));
    // EXPECT_FALSE(fs::exists(pathPfx_ / "lost+found"));

    SCOCacheMountPointList& l = getMountPointList(*scoCache);
    EXPECT_EQ(2U, l.size());

    BOOST_FOREACH(SCOCacheMountPointPtr mp, l)
    {
        EXPECT_TRUE(one == mp->getPath() ||
                    two == mp->getPath()) << mp->getPath();
    }
    std::pair<double, double>
    run_test(barrier_inserter& insert_barrier,
             bool prefill,
             uint64_t tasks_per_queue,
             unsigned num_queues,
             unsigned num_threads,
             uint64_t delay_us,
             unsigned idle_queues)
    {
        EXPECT_LT(0U, tasks_per_queue);
        EXPECT_LT(0U, num_queues);
        EXPECT_LE(0U, idle_queues);

        boost::property_tree::ptree pt;
        PARAMETER_TYPE(ip::perf_threadpool_test_threads)(num_threads).persist(pt);
        pt.put("version", 1);
        std::unique_ptr<threadpool_type> tp(new threadpool_type(pt));

        BOOST_SCOPE_EXIT_TPL((&tp))
        {
            EXPECT_NO_THROW(tp->stop()) << "Failed to stop threadpool";
        }
        BOOST_SCOPE_EXIT_END;

        {
            blocker_ptr_vec blockers(idle_queues);

            for (size_t i = 0; i < idle_queues; ++i)
            {
                blockers[i] = blocker_ptr(new Blocker(*tp, num_queues + i));
            }
        }

        callback_ptr_vec callbacks(num_queues);

        for (size_t i = 0; i < callbacks.size(); ++i)
        {
            callbacks[i] = callback_ptr(new Callback(tasks_per_queue, delay_us));
        }

        youtils::wall_timer t;

        double post_time;

        if (prefill)
        {
            blocker_ptr_vec blockers(num_queues);
            for (size_t i = 0; i < blockers.size(); ++i)
            {
                blockers[i] = blocker_ptr(new Blocker(*tp, i));
            }

            post_time = post_tasks_(insert_barrier, *tp, callbacks, tasks_per_queue);
            t.restart();
        }
        else
        {
            post_time = post_tasks_(insert_barrier, *tp, callbacks, tasks_per_queue);
        }

        for (size_t i = 0; i < callbacks.size(); ++i)
        {
            callback_ptr cb = callbacks[i];
            std::unique_lock<Callback::lock_type> u(cb->lock_);
            while (cb->count_ > 0)
            {
                ASSERT(cb->count_ <= tasks_per_queue);
                cb->cond_.wait(u);
            }
        }

        const double proc_time = t.elapsed();

        std::cout <<
            "# queues: " << num_queues <<
            ", tasks per queue: " << tasks_per_queue <<
            ", # idle queues: " << idle_queues <<
            ", threads in pool: " << tp->getNumThreads() <<
            ", delay per task (us): " << delay_us <<
            ", processing duration (s): " << proc_time <<
            std::endl;

        return std::make_pair(post_time, proc_time);
    }