Commit 7c034057 authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch '105-add-lseek-tests' into 'master'

Resolve "Add lseek tests"

Closes #105

See merge request !45
parents 2a8773a7 9bd1477c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1012,7 +1012,7 @@ struct get_metadentry_size {

    // Mercury callback to serialize output arguments
    constexpr static const auto mercury_out_proc_cb =
            HG_GEN_PROC_NAME(rpc_err_out_t);
            HG_GEN_PROC_NAME(rpc_get_metadentry_size_out_t);

    class input {

+6 −0
Original line number Diff line number Diff line
@@ -319,10 +319,16 @@ off_t gkfs_lseek(shared_ptr<gkfs::filemap::OpenFile> gkfs_fd, off_t offset, unsi
        case SEEK_END: {
            off64_t file_size;
            auto err = gkfs::rpc::forward_get_metadentry_size(gkfs_fd->path(), file_size);
          
            if (err < 0) {
                errno = err; // Negative numbers are explicitly for error codes
                return -1;
            }
            
            if (offset < 0 and file_size < -offset) {
                errno = EINVAL;
                return -1;
            }
            gkfs_fd->pos(file_size + offset);
            break;
        }
+16 −0
Original line number Diff line number Diff line
@@ -30,6 +30,13 @@ gkfs_add_python_test(
    SOURCE operations/
)

gkfs_add_python_test(
    NAME test_lseek
    PYTHON_VERSION 3.6
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/integration
    SOURCE position/test_lseek.py
)

gkfs_add_python_test(
    NAME test_shell
    PYTHON_VERSION 3.6
@@ -71,6 +78,15 @@ if(GKFS_INSTALL_TESTS)
            PATTERN ".pytest_cache" EXCLUDE
    )

    install(DIRECTORY position
        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration
        FILES_MATCHING
            REGEX ".*\\.py"
            PATTERN "__pycache__" EXCLUDE
            PATTERN ".pytest_cache" EXCLUDE
    )


    install(DIRECTORY shell
        DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gkfs/tests/integration
        FILES_MATCHING
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ add_executable(gkfs.io
    gkfs.io/writev.cpp
    gkfs.io/pwritev.cpp
    gkfs.io/statx.cpp
    gkfs.io/lseek.cpp
)

include(FetchContent)
+3 −0
Original line number Diff line number Diff line
@@ -62,4 +62,7 @@ pwritev_init(CLI::App& app);
void
statx_init(CLI::App& app);

void
lseek_init(CLI::App& app);

#endif // IO_COMMANDS_HPP
Loading