Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hpc
gekkofs
Commits
2917d583
Commit
2917d583
authored
May 25, 2022
by
Ramon Nou
Browse files
Added GKFS_ENABLE_UNUSED_FUNCTIONS
changed coverage tests name
parent
a8dd42c9
Changes
10
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
2917d583
...
...
@@ -8,6 +8,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### New
-
Additional tests to increase code coverage (
[
!141
](
https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141
)
).
-
GKFS_ENABLE_UNUSED_FUNCTIONS added to disable code to increase code coverage.
### Changed
-
Support parallelism for path resolution tests (
[
!145
](
https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/145
)
).
-
Support parallelism for symlink tests (
[
!147
](
https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/147
)
).
...
...
CMakeLists.txt
View file @
2917d583
...
...
@@ -178,6 +178,8 @@ if (GKFS_ENABLE_AGIOS)
find_package
(
AGIOS REQUIRED
)
endif
()
option
(
GKFS_ENABLE_UNUSED_FUNCTIONS
"Enable unused functions compilation"
OFF
)
option
(
GKFS_ENABLE_PARALLAX
"Enable Parallax db backend"
OFF
)
option
(
GKFS_ENABLE_ROCKSDB
"Enable ROCKSDB backend"
ON
)
...
...
include/common/rpc/rpc_util.hpp
View file @
2917d583
...
...
@@ -44,7 +44,7 @@ bool_to_merc_bool(bool state);
std
::
string
get_my_hostname
(
bool
short_hostname
=
false
);
#ifdef ENABLE_UNUSED_FUNCTIONS
#ifdef
GKFS_
ENABLE_UNUSED_FUNCTIONS
std
::
string
get_host_by_name
(
const
std
::
string
&
hostname
);
#endif
...
...
src/client/gkfs_functions.cpp
View file @
2917d583
...
...
@@ -411,7 +411,7 @@ gkfs_statfs(struct statfs* buf) {
return
0
;
}
#ifdef ENABLE_UNUSED_FUNCTIONS
#ifdef
GKFS_
ENABLE_UNUSED_FUNCTIONS
/**
* gkfs wrapper for statvfs() system calls
* errno may be set
...
...
@@ -1096,7 +1096,7 @@ gkfs_getdents64(unsigned int fd, struct linux_dirent64* dirp,
#ifdef HAS_SYMLINKS
#ifdef ENABLE_UNUSED_FUNCTIONS
#ifdef
GKFS_
ENABLE_UNUSED_FUNCTIONS
/**
* gkfs wrapper for make symlink() system calls
* errno may be set
...
...
src/common/rpc/rpc_util.cpp
View file @
2917d583
...
...
@@ -73,7 +73,7 @@ get_my_hostname(bool short_hostname) {
return
""
s
;
}
#ifdef ENABLE_UNUSED_FUNCTIONS
#ifdef
GKFS_
ENABLE_UNUSED_FUNCTIONS
string
get_host_by_name
(
const
string
&
hostname
)
{
int
err
=
0
;
...
...
tests/integration/CMakeLists.txt
View file @
2917d583
...
...
@@ -121,10 +121,10 @@ gkfs_add_python_test(
)
gkfs_add_python_test
(
NAME test_
coverage
NAME test_
syscalls
PYTHON_VERSION 3.6
WORKING_DIRECTORY
${
PROJECT_SOURCE_DIR
}
/tests/integration
SOURCE
coverage
/
SOURCE
syscalls
/
)
if
(
GKFS_INSTALL_TESTS
)
...
...
@@ -189,7 +189,7 @@ if(GKFS_INSTALL_TESTS)
PATTERN
".pytest_cache"
EXCLUDE
)
install
(
DIRECTORY
coverage
install
(
DIRECTORY
syscalls
DESTINATION
${
CMAKE_INSTALL_DATAROOTDIR
}
/gkfs/tests/integration
FILES_MATCHING
REGEX
".*
\\
.py"
...
...
tests/integration/syscalls/test_error_operations.py
0 → 100644
View file @
2917d583
################################################################################
# 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
sh
import
sys
import
pytest
from
harness.logger
import
logger
nonexisting
=
"nonexisting"
def
test_open_error
(
gkfs_daemon
,
gkfs_client
):
file
=
gkfs_daemon
.
mountdir
/
"file"
file2
=
gkfs_daemon
.
mountdir
/
"file2"
file3
=
gkfs_daemon
.
mountdir
/
"file3"
flags
=
[
os
.
O_PATH
,
os
.
O_APPEND
,
os
.
O_CREAT
|
os
.
O_DIRECTORY
]
# create a file in gekkofs
for
flag
in
flags
:
ret
=
gkfs_client
.
open
(
file
,
flag
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOTSUP
# Create file and recreate
ret
=
gkfs_client
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_EXCL
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
ret
=
gkfs_client
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_EXCL
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
EEXIST
# Create file and recreate
ret
=
gkfs_client
.
open
(
file2
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
# Undefined in man
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
assert
ret
.
errno
==
errno
.
ENOENT
ret
=
gkfs_client
.
open
(
file3
,
os
.
O_CREAT
|
stat
.
S_IFSOCK
|
os
.
O_EXCL
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
def
test_access_error
(
gkfs_daemon
,
gkfs_client
):
file
=
gkfs_daemon
.
mountdir
/
"file"
file2
=
gkfs_daemon
.
mountdir
/
"file2"
ret
=
gkfs_client
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
# Access, flags are not being used
ret
=
gkfs_client
.
access
(
file2
,
os
.
R_OK
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOENT
ret
=
gkfs_client
.
access
(
file
,
os
.
R_OK
)
assert
ret
.
retval
!=
-
1
def
test_stat_error
(
gkfs_daemon
,
gkfs_client
):
# Stat non existing file
file
=
gkfs_daemon
.
mountdir
/
"file"
ret
=
gkfs_client
.
stat
(
file
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOENT
# test statx on existing file
ret
=
gkfs_client
.
statx
(
0
,
file
,
0
,
0
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOENT
def
test_statfs
(
gkfs_daemon
,
gkfs_client
):
# Statfs check most of the outputs
ret
=
gkfs_client
.
statfs
(
gkfs_daemon
.
mountdir
)
assert
ret
.
retval
==
0
assert
ret
.
statfsbuf
.
f_type
==
0
assert
ret
.
statfsbuf
.
f_bsize
!=
0
assert
ret
.
statfsbuf
.
f_blocks
!=
0
assert
ret
.
statfsbuf
.
f_bfree
!=
0
assert
ret
.
statfsbuf
.
f_bavail
!=
0
assert
ret
.
statfsbuf
.
f_files
==
0
assert
ret
.
statfsbuf
.
f_ffree
==
0
def
test_check_parents
(
gkfs_daemon
,
gkfs_client
):
file
=
gkfs_daemon
.
mountdir
/
"dir"
/
"file"
file2
=
gkfs_daemon
.
mountdir
/
"file2"
file3
=
gkfs_daemon
.
mountdir
/
"file2"
/
"file3"
# Parent directory does not exist
ret
=
gkfs_client
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
ENOENT
# Create file
ret
=
gkfs_client
.
open
(
file2
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
assert
ret
.
retval
==
10000
# Create file over a file
ret
=
gkfs_client
.
open
(
file3
,
os
.
O_CREAT
|
os
.
O_WRONLY
)
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
tests/integration/syscalls/test_syscalls.py
0 → 100644
View file @
2917d583
################################################################################
# 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
.
syscall
==
"ALLOK"
assert
ret
.
retval
==
0
assert
ret
.
errno
==
0
tests/unit/test_example_00.cpp
0 → 100644
View file @
2917d583
/*
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
*/
#include
<catch2/catch.hpp>
#include
<fmt/format.h>
unsigned
int
Factorial
(
unsigned
int
number
)
{
return
number
<=
1
?
number
:
Factorial
(
number
-
1
)
*
number
;
}
TEST_CASE
(
"Factorials are computed"
,
"[factorial]"
)
{
REQUIRE
(
Factorial
(
1
)
==
1
);
REQUIRE
(
Factorial
(
2
)
==
2
);
REQUIRE
(
Factorial
(
3
)
==
6
);
REQUIRE
(
Factorial
(
10
)
==
3628800
);
}
TEST_CASE
(
"Two and Two is Four"
,
"[2+2=4]"
)
{
REQUIRE
(
2
+
2
==
4
);
}
tests/unit/test_example_01.cpp
0 → 100644
View file @
2917d583
/*
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
*/
#include
<catch2/catch.hpp>
#include
<fmt/format.h>
SCENARIO
(
"vectors can be sized and resized"
,
"[vector]"
)
{
GIVEN
(
"A vector with some items"
)
{
std
::
vector
<
int
>
v
(
5
);
REQUIRE
(
v
.
size
()
==
5
);
REQUIRE
(
v
.
capacity
()
>=
5
);
WHEN
(
"the size is increased"
)
{
v
.
resize
(
10
);
THEN
(
"the size and capacity change"
)
{
REQUIRE
(
v
.
size
()
==
10
);
REQUIRE
(
v
.
capacity
()
>=
10
);
}
}
WHEN
(
"the size is reduced"
)
{
v
.
resize
(
0
);
THEN
(
"the size changes but not capacity"
)
{
REQUIRE
(
v
.
size
()
==
0
);
REQUIRE
(
v
.
capacity
()
>=
5
);
}
}
WHEN
(
"more capacity is reserved"
)
{
v
.
reserve
(
10
);
THEN
(
"the capacity changes but not the size"
)
{
REQUIRE
(
v
.
size
()
==
5
);
REQUIRE
(
v
.
capacity
()
>=
10
);
}
}
WHEN
(
"less capacity is reserved"
)
{
v
.
reserve
(
0
);
THEN
(
"neither size nor capacity are changed"
)
{
REQUIRE
(
v
.
size
()
==
5
);
REQUIRE
(
v
.
capacity
()
>=
5
);
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment