Commit 9a9ad69c authored by Ramon Nou's avatar Ramon Nou Committed by Ramon Nou
Browse files

dup dup2 testing

syscall testing coverage
parent 4110d879
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -233,6 +233,7 @@ gkfs:unit:
    - ctest -j $(nproc) -L unit::all --output-junit report.xml

    ## capture coverage information
    - cd ${BUILD_PATH}
    - ${CI_SCRIPTS_DIR}/coverage.sh
          --verbose
          --capture unit
+19 −1
Original line number Diff line number Diff line
@@ -75,11 +75,18 @@ def test_open_error(gkfs_daemon, gkfs_client):
    ret = gkfs_client.open(file2, os.O_CREAT | os.O_WRONLY)
    assert ret.retval == 10000
   
    # RDWR
    ret = gkfs_client.open(file2, os.O_RDWR)
    assert ret.retval == 10000

    # RD
    ret = gkfs_client.open(file2, os.O_RDONLY)
    assert ret.retval == 10000
   
    # Truncate the file
    ret = gkfs_client.open(file2, os.O_TRUNC | os.O_WRONLY)
    assert ret.retval == 10000


    # Open unexistent file
    ret = gkfs_client.open(file3, os.O_WRONLY)
    assert ret.retval == -1
@@ -150,3 +157,14 @@ def test_check_parents(gkfs_daemon, gkfs_client):
    assert ret.retval == -1
    assert ret.errno == errno.ENOTDIR


def test_dup(gkfs_daemon, gkfs_client):
    file = gkfs_daemon.mountdir / "file"

    ret = gkfs_client.open(file, os.O_CREAT | os.O_WRONLY)
    assert ret.retval == 10000

    ret = gkfs_client.dup_validate(file)
    assert ret.retval == 0
    assert ret.errno == 0
+56 −0
Original line number Diff line number Diff line
################################################################################
# Copyright 2018-2022, Barcelona Supercomputing Center (BSC), Spain            #
# Copyright 2015-2022, Johannes Gutenberg Universitaet Mainz, Germany          #
#                                                                              #
# This software was partially supported by the                                 #
# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).    #
#                                                                              #
# This software was partially supported by the                                 #
# ADA-FS project under the SPPEXA project funded by the DFG.                   #
#                                                                              #
# This file is part of GekkoFS.                                                #
#                                                                              #
# GekkoFS is free software: you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by         #
# the Free Software Foundation, either version 3 of the License, or            #
# (at your option) any later version.                                          #
#                                                                              #
# GekkoFS is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
# GNU General Public License for more details.                                 #
#                                                                              #
# You should have received a copy of the GNU General Public License            #
# along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.            #
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

from sre_parse import State
import harness
from pathlib import Path
import errno
import stat
import os
import ctypes
import sys
import pytest
from harness.logger import logger
import ctypes
nonexisting = "nonexisting"


def test_syscalls(gkfs_daemon, gkfs_client):

    file = gkfs_daemon.mountdir / "file"

    ret = gkfs_client.open(file, os.O_CREAT | os.O_WRONLY)
    assert ret.retval == 10000


    ret = gkfs_client.syscall_coverage(file)
    assert ret.retval == 0
    assert ret.errno == 0

    
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ add_executable(gkfs.io
    gkfs.io/unlink.cpp
    gkfs.io/access.cpp
    gkfs.io/statfs.cpp
    gkfs.io/dup_validate.cpp
    gkfs.io/syscall_coverage.cpp
)

include(FetchContent)
+6 −0
Original line number Diff line number Diff line
@@ -117,4 +117,10 @@ symlink_init(CLI::App& app);
void
unlink_init(CLI::App& app);

void
dup_validate_init(CLI::App& app);

void
syscall_coverage_init(CLI::App& app);

#endif // IO_COMMANDS_HPP
Loading