sapling/eden/fs/testharness/TestChecks.h
Katie Mancini 480277e328 refactor - move ObjectFetchContext to its own file
Summary:
In following changes I will be threading ObjectFetchContext into the backing
store importing process, since this will start to be used more outside of the
ObjectStore, I am moving this class into its own files.

Reviewed By: chadaustin

Differential Revision: D22022488

fbshipit-source-id: 1a291fea6e0fd56855936962363dfc9f6de8533d
2020-06-23 10:02:40 -07:00

45 lines
2.1 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <folly/Format.h>
#include <folly/Range.h>
#include <folly/io/IOBuf.h>
#include <gtest/gtest.h>
#include "eden/fs/inodes/FileInode.h"
#include "eden/fs/store/ObjectFetchContext.h"
/**
* Check that a FileInode has the expected contents and permissions.
*/
#ifndef _WIN32
#define EXPECT_FILE_INODE(fileInode, expectedData, expectedPerms) \
do { \
EXPECT_EQ( \
expectedData, \
folly::StringPiece{(fileInode) \
->readAll(ObjectFetchContext::getNullContext()) \
.get(std::chrono::seconds(20))}) \
<< " for inode path " << (fileInode)->getLogPath(); \
EXPECT_EQ( \
folly::sformat("{:#o}", (expectedPerms)), \
folly::sformat("{:#o}", (fileInode)->getPermissions())) \
<< " for inode path " << (fileInode)->getLogPath(); \
} while (0)
#else
#define EXPECT_FILE_INODE(fileInode, expectedData, expectedPerms) \
do { \
EXPECT_EQ( \
expectedData, \
folly::StringPiece{(fileInode) \
->readAll(ObjectFetchContext::getNullContext()) \
.get(std::chrono::seconds(20))}) \
<< " for inode path " << (fileInode)->getLogPath(); \
} while (0)
#endif