fix DBTest2.ReadAmpBitmapLiveInCacheAfterDBClose file ID support check

Summary:
Updated the test case to handle tmpfs mounted at directories different from "/dev/shm/".
Closes https://github.com/facebook/rocksdb/pull/3440

Differential Revision: D6848213

Pulled By: ajkr

fbshipit-source-id: 465e9dbf0921d0930161f732db6b3766bb030589
This commit is contained in:
Andrew Kryczka 2018-01-30 16:41:21 -08:00 committed by Facebook Github Bot
parent ec225d2e97
commit ab5ab36ac2

View File

@ -1820,12 +1820,18 @@ TEST_F(DBTest2, ReadAmpBitmap) {
#ifndef OS_SOLARIS // GetUniqueIdFromFile is not implemented
TEST_F(DBTest2, ReadAmpBitmapLiveInCacheAfterDBClose) {
if (dbname_.find("dev/shm") != std::string::npos) {
// /dev/shm dont support getting a unique file id, this mean that
// running this test on /dev/shm will fail because lru_cache will load
{
const int kIdBufLen = 100;
char id_buf[kIdBufLen];
std::unique_ptr<RandomAccessFile> file;
env_->NewRandomAccessFile(dbname_, &file, EnvOptions());
if (file->GetUniqueId(id_buf, kIdBufLen) == 0) {
// fs holding db directory doesn't support getting a unique file id,
// this means that running this test will fail because lru_cache will load
// the blocks again regardless of them being already in the cache
return;
}
}
uint32_t bytes_per_bit[2] = {1, 16};
for (size_t k = 0; k < 2; k++) {
std::shared_ptr<Cache> lru_cache = NewLRUCache(1024 * 1024 * 1024);