Skip to content

[C++][FS][Azure] Use the generic filesystem tests #39069

Closed

Description

@kou

Describe the enhancement requested

// Generic tests for FileSystem implementations.
// To use this class, subclass both from it and ::testing::Test,
// implement GetEmptyFileSystem(), and use GENERIC_FS_TEST_FUNCTIONS()
// to define the various tests.
class ARROW_TESTING_EXPORT GenericFileSystemTest {
public:
virtual ~GenericFileSystemTest();
void TestEmpty();
void TestNormalizePath();
void TestCreateDir();
void TestDeleteDir();
void TestDeleteDirContents();
void TestDeleteRootDirContents();
void TestDeleteFile();
void TestDeleteFiles();
void TestMoveFile();
void TestMoveDir();
void TestCopyFile();
void TestGetFileInfo();
void TestGetFileInfoVector();
void TestGetFileInfoSelector();
void TestGetFileInfoSelectorWithRecursion();
void TestGetFileInfoAsync();
void TestGetFileInfoGenerator();
void TestOpenOutputStream();
void TestOpenAppendStream();
void TestOpenInputStream();
void TestOpenInputStreamWithFileInfo();
void TestOpenInputStreamAsync();
void TestOpenInputFile();
void TestOpenInputFileWithFileInfo();
void TestOpenInputFileAsync();
void TestSpecialChars();
protected:
// This function should return the filesystem under test.
virtual std::shared_ptr<FileSystem> GetEmptyFileSystem() = 0;
// Override the following functions to specify deviations from expected
// filesystem semantics.
// - Whether the filesystem may "implicitly" create intermediate directories
virtual bool have_implicit_directories() const { return false; }
// - Whether the filesystem may allow writing a file "over" a directory
virtual bool allow_write_file_over_dir() const { return false; }
// - Whether the filesystem allows reading a directory
virtual bool allow_read_dir_as_file() const { return false; }
// - Whether the filesystem allows moving a directory
virtual bool allow_move_dir() const { return true; }
// - Whether the filesystem allows moving a directory "over" a non-empty destination
virtual bool allow_move_dir_over_non_empty_dir() const { return false; }
// - Whether the filesystem allows appending to a file
virtual bool allow_append_to_file() const { return true; }
// - Whether the filesystem allows appending to a new (not existent yet) file
virtual bool allow_append_to_new_file() const { return true; }
// - Whether the filesystem supports directory modification times
virtual bool have_directory_mtimes() const { return true; }
// - Whether some directory tree deletion tests may fail randomly
virtual bool have_flaky_directory_tree_deletion() const { return false; }
// - Whether the filesystem stores some metadata alongside files
virtual bool have_file_metadata() const { return false; }
void TestEmpty(FileSystem* fs);
void TestNormalizePath(FileSystem* fs);
void TestCreateDir(FileSystem* fs);
void TestDeleteDir(FileSystem* fs);
void TestDeleteDirContents(FileSystem* fs);
void TestDeleteRootDirContents(FileSystem* fs);
void TestDeleteFile(FileSystem* fs);
void TestDeleteFiles(FileSystem* fs);
void TestMoveFile(FileSystem* fs);
void TestMoveDir(FileSystem* fs);
void TestCopyFile(FileSystem* fs);
void TestGetFileInfo(FileSystem* fs);
void TestGetFileInfoVector(FileSystem* fs);
void TestGetFileInfoSelector(FileSystem* fs);
void TestGetFileInfoSelectorWithRecursion(FileSystem* fs);
void TestGetFileInfoAsync(FileSystem* fs);
void TestGetFileInfoGenerator(FileSystem* fs);
void TestOpenOutputStream(FileSystem* fs);
void TestOpenAppendStream(FileSystem* fs);
void TestOpenInputStream(FileSystem* fs);
void TestOpenInputStreamWithFileInfo(FileSystem* fs);
void TestOpenInputStreamAsync(FileSystem* fs);
void TestOpenInputFile(FileSystem* fs);
void TestOpenInputFileWithFileInfo(FileSystem* fs);
void TestOpenInputFileAsync(FileSystem* fs);
void TestSpecialChars(FileSystem* fs);
};
#define GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, NAME) \
TEST_MACRO(TEST_CLASS, NAME) { this->Test##NAME(); }
#define GENERIC_FS_TEST_FUNCTIONS_MACROS(TEST_MACRO, TEST_CLASS) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, Empty) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, NormalizePath) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, CreateDir) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteDir) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteDirContents) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteRootDirContents) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteFile) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, DeleteFiles) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, MoveFile) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, MoveDir) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, CopyFile) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfo) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoVector) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoSelector) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoSelectorWithRecursion) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoAsync) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, GetFileInfoGenerator) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenOutputStream) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenAppendStream) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputStream) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputStreamWithFileInfo) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputStreamAsync) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputFile) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputFileWithFileInfo) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, OpenInputFileAsync) \
GENERIC_FS_TEST_FUNCTION(TEST_MACRO, TEST_CLASS, SpecialChars)
#define GENERIC_FS_TEST_FUNCTIONS(TEST_CLASS) \
GENERIC_FS_TEST_FUNCTIONS_MACROS(TEST_F, TEST_CLASS)
#define GENERIC_FS_TYPED_TEST_FUNCTIONS(TEST_CLASS) \
GENERIC_FS_TEST_FUNCTIONS_MACROS(TYPED_TEST, TEST_CLASS)

This is a child of #18014.

Component(s)

C++

Activity

  1. added 2 commits that reference this issue on Mar 28, 2024
  2. added this to the 16.0.0 milestone on Apr 1, 2024
  3. kou commented on Apr 1, 2024

    @kou
    MemberAuthor

    Issue resolved by pull request 40567
    #40567

  4. added a commit that references this issue on May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions