2014-12-02 22:16:48 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef TEST_FSPP_FUSE_READDIR_TESTUTILS_FUSEREADDIRTEST_H_
|
|
|
|
#define TEST_FSPP_FUSE_READDIR_TESTUTILS_FUSEREADDIRTEST_H_
|
|
|
|
|
2015-02-17 00:48:49 +01:00
|
|
|
#include "../../../testutils/FuseTest.h"
|
2014-12-02 22:16:48 +01:00
|
|
|
#include <dirent.h>
|
2015-03-10 21:51:12 +01:00
|
|
|
#include "../../../../fs_interface/Dir.h"
|
2014-12-02 22:16:48 +01:00
|
|
|
|
|
|
|
class FuseReadDirTest: public FuseTest {
|
|
|
|
public:
|
|
|
|
const char *DIRNAME = "/mydir";
|
|
|
|
|
2015-06-18 19:30:52 +02:00
|
|
|
cpputils::unique_ref<std::vector<std::string>> ReadDir(const char *dirname);
|
2014-12-02 22:16:48 +01:00
|
|
|
int ReadDirReturnError(const char *dirname);
|
|
|
|
|
2015-03-10 21:51:12 +01:00
|
|
|
static ::testing::Action<std::vector<fspp::Dir::Entry>*(const char*)> ReturnDirEntries(std::vector<std::string> entries);
|
2014-12-02 22:16:48 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
DIR *openDir(TempTestFS *fs, const char *dirname);
|
|
|
|
DIR *openDirAllowError(TempTestFS *fs, const char *dirname);
|
|
|
|
void readDirEntries(DIR *dir, std::vector<std::string> *result);
|
|
|
|
int readDirEntriesAllowError(DIR *dir, std::vector<std::string> *result);
|
|
|
|
int readNextDirEntryAllowError(DIR *dir, struct dirent **result);
|
|
|
|
void closeDir(DIR *dir);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|