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
90e03f6c
Commit
90e03f6c
authored
May 17, 2022
by
Ramon Nou
Browse files
GCC 12.1 update and statvfs
Added statvfs in tests enable extra features in gekkofs
parent
897c31d4
Changes
9
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
90e03f6c
...
...
@@ -49,6 +49,12 @@ gkfs:
interruptible
:
true
needs
:
[]
script
:
# Change config.hpp with sed to enable extra features
-
sed -i 's/\/\/constexpr auto use_atime =
false
;/constexpr auto use_atime =
true
;/g' "${CI_PROJECT_DIR}/src/config.hpp"
-
sed -i 's/\/\/constexpr auto use_ctime =
false
;/constexpr auto use_ctime =
true
;/g' "${CI_PROJECT_DIR}/src/config.hpp"
-
sed -i 's/\/\/constexpr auto use_mtime =
false
;/constexpr auto use_mtime =
true
;/g' "${CI_PROJECT_DIR}/src/config.hpp"
-
sed -i 's/\/\/constexpr auto use_link_cnt =
false
;/constexpr auto use_link_cnt =
true
;/g' "${CI_PROJECT_DIR}/src/config.hpp"
-
sed -i 's/\/\/constexpr auto use_blocks =
false
;/constexpr auto use_blocks =
true
;/g' "${CI_PROJECT_DIR}/src/config.hpp"
-
mkdir -p ${BUILD_PATH} && cd ${BUILD_PATH}
-
cmake
-Wdev
...
...
include/client/open_file_map.hpp
View file @
90e03f6c
...
...
@@ -34,6 +34,7 @@
#include
<mutex>
#include
<memory>
#include
<atomic>
#include
<array>
namespace
gkfs
::
filemap
{
...
...
tests/integration/coverage/test_error_operations.py
View file @
90e03f6c
...
...
@@ -26,6 +26,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later #
################################################################################
from
sre_parse
import
State
import
harness
from
pathlib
import
Path
import
errno
...
...
@@ -80,6 +81,9 @@ def test_open_error(gkfs_daemon, gkfs_client):
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"
...
...
@@ -123,5 +127,16 @@ def test_statfs(gkfs_daemon, gkfs_client):
assert
ret
.
statfsbuf
.
f_ffree
==
0
def
test_statvfs
(
gkfs_daemon
,
gkfs_client
):
# Statfs check most of the outputs
ret
=
gkfs_client
.
statvfs
(
gkfs_daemon
.
mountdir
)
assert
ret
.
retval
==
0
assert
ret
.
statvfsbuf
.
f_bsize
!=
0
assert
ret
.
statvfsbuf
.
f_blocks
!=
0
assert
ret
.
statvfsbuf
.
f_bfree
!=
0
assert
ret
.
statvfsbuf
.
f_bavail
!=
0
assert
ret
.
statvfsbuf
.
f_files
==
0
assert
ret
.
statvfsbuf
.
f_ffree
==
0
\ No newline at end of file
tests/integration/harness/CMakeLists.txt
View file @
90e03f6c
...
...
@@ -65,6 +65,7 @@ add_executable(gkfs.io
gkfs.io/unlink.cpp
gkfs.io/access.cpp
gkfs.io/statfs.cpp
gkfs.io/statvfs.cpp
)
include
(
FetchContent
)
...
...
tests/integration/harness/gkfs.io/commands.hpp
View file @
90e03f6c
...
...
@@ -102,6 +102,9 @@ access_init(CLI::App& app);
void
statfs_init
(
CLI
::
App
&
app
);
void
statvfs_init
(
CLI
::
App
&
app
);
// UTIL
void
file_compare_init
(
CLI
::
App
&
app
);
...
...
tests/integration/harness/gkfs.io/main.cpp
View file @
90e03f6c
...
...
@@ -59,6 +59,7 @@ init_commands(CLI::App& app) {
truncate_init
(
app
);
access_init
(
app
);
statfs_init
(
app
);
statvfs_init
(
app
);
// utils
file_compare_init
(
app
);
chdir_init
(
app
);
...
...
tests/integration/harness/gkfs.io/serialize.hpp
View file @
90e03f6c
...
...
@@ -35,6 +35,7 @@
extern
"C"
{
#include
<sys/stat.h>
#include
<sys/vfs.h>
#include
<sys/statvfs.h>
}
template
<
typename
T
>
...
...
@@ -187,6 +188,22 @@ struct adl_serializer<struct ::statfs> {
}
};
// ADL specialization for struct ::statvfs (not exhaustive) type
template
<
>
struct
adl_serializer
<
struct
::
statvfs
>
{
static
void
to_json
(
json
&
j
,
const
struct
::
statvfs
opt
)
{
j
=
json
{
{
"f_bsize"
,
opt
.
f_bsize
},
{
"f_blocks"
,
opt
.
f_blocks
},
{
"f_bfree"
,
opt
.
f_bfree
},
{
"f_bavail"
,
opt
.
f_bavail
},
{
"f_files"
,
opt
.
f_files
},
{
"f_ffree"
,
opt
.
f_ffree
},
{
"f_favail"
,
opt
.
f_favail
}};
}
};
#ifdef STATX_TYPE
// ADL specialization for struct ::statx type
template
<
>
...
...
tests/integration/harness/gkfs.io/statvfs.cpp
0 → 100644
View file @
90e03f6c
/*
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
*/
/* C++ includes */
#include
<CLI11/CLI11.hpp>
#include
<nlohmann/json.hpp>
#include
<memory>
#include
<fmt/format.h>
#include
<commands.hpp>
#include
<reflection.hpp>
#include
<serialize.hpp>
/* C includes */
#include
<sys/types.h>
#include
<sys/statvfs.h>
#include
<unistd.h>
using
json
=
nlohmann
::
json
;
struct
statvfs_options
{
bool
verbose
{};
std
::
string
pathname
;
REFL_DECL_STRUCT
(
statvfs_options
,
REFL_DECL_MEMBER
(
bool
,
verbose
),
REFL_DECL_MEMBER
(
std
::
string
,
pathname
));
};
struct
statvfs_output
{
int
retval
;
int
errnum
;
struct
::
statvfs
statvfsbuf
;
REFL_DECL_STRUCT
(
statvfs_output
,
REFL_DECL_MEMBER
(
int
,
retval
),
REFL_DECL_MEMBER
(
int
,
errnum
),
REFL_DECL_MEMBER
(
struct
::
statvfs
,
statvfsbuf
));
};
void
to_json
(
json
&
record
,
const
statvfs_output
&
out
)
{
record
=
serialize
(
out
);
}
void
statvfs_exec
(
const
statvfs_options
&
opts
)
{
struct
::
statvfs
statvfsbuf
;
auto
rv
=
::
statvfs
(
opts
.
pathname
.
c_str
(),
&
statvfsbuf
);
if
(
opts
.
verbose
)
{
fmt
::
print
(
"statvfs(pathname=
\"
{}
\"
) = {}, errno: {} [{}]
\n
"
,
opts
.
pathname
,
rv
,
errno
,
::
strerror
(
errno
));
return
;
}
json
out
=
statvfs_output
{
rv
,
errno
,
statvfsbuf
};
fmt
::
print
(
"{}
\n
"
,
out
.
dump
(
2
));
}
void
statvfs_init
(
CLI
::
App
&
app
)
{
// Create the option and subcommand objects
auto
opts
=
std
::
make_shared
<
statvfs_options
>
();
auto
*
cmd
=
app
.
add_subcommand
(
"statvfs"
,
"Execute the statvfs() system call"
);
// Add options to cmd, binding them to opts
cmd
->
add_flag
(
"-v,--verbose"
,
opts
->
verbose
,
"Produce human readable output"
);
cmd
->
add_option
(
"pathname"
,
opts
->
pathname
,
"Directory name"
)
->
required
()
->
type_name
(
""
);
cmd
->
callback
([
opts
]()
{
statvfs_exec
(
*
opts
);
});
}
tests/integration/harness/io.py
View file @
90e03f6c
...
...
@@ -104,6 +104,28 @@ class StructStatfsSchema(Schema):
[
'f_type'
,
'f_bsize'
,
'f_blocks'
,
'f_bfree'
,
'f_bavail'
,
'f_files'
,
'f_ffree'
])(
**
data
)
class
StructStatvfsSchema
(
Schema
):
"""Schema that deserializes a struct statvfs"""
f_bsize
=
fields
.
Integer
(
required
=
True
)
f_blocks
=
fields
.
Integer
(
required
=
True
)
f_bfree
=
fields
.
Integer
(
required
=
True
)
f_bavail
=
fields
.
Integer
(
required
=
True
)
f_files
=
fields
.
Integer
(
required
=
True
)
f_ffree
=
fields
.
Integer
(
required
=
True
)
f_favail
=
fields
.
Integer
(
required
=
True
)
# f_fsid = fields.Integer(required=True)
# f_namelen = fields.Integer(required=True)
# f_frsize = fields.Integer(required=True)
# f_flags = fields.Integer(required=True)
@
post_load
def
make_object
(
self
,
data
,
**
kwargs
):
return
namedtuple
(
'StructStatfs'
,
[
'f_bsize'
,
'f_blocks'
,
'f_bfree'
,
'f_bavail'
,
'f_files'
,
'f_ffree'
,
'f_favail'
])(
**
data
)
class
StructStatxTimestampSchema
(
Schema
):
"""Schema that deserializes a struct timespec"""
tv_sec
=
fields
.
Integer
(
required
=
True
)
...
...
@@ -330,6 +352,17 @@ class StatfsOutputSchema(Schema):
def
make_object
(
self
,
data
,
**
kwargs
):
return
namedtuple
(
'StatfsReturn'
,
[
'retval'
,
'statfsbuf'
,
'errno'
])(
**
data
)
class
StatvfsOutputSchema
(
Schema
):
"""Schema to deserialize the results of a statfs() execution"""
retval
=
fields
.
Integer
(
required
=
True
)
statvfsbuf
=
fields
.
Nested
(
StructStatvfsSchema
,
required
=
True
)
errno
=
Errno
(
data_key
=
'errnum'
,
required
=
True
)
@
post_load
def
make_object
(
self
,
data
,
**
kwargs
):
return
namedtuple
(
'StatvfsReturn'
,
[
'retval'
,
'statvfsbuf'
,
'errno'
])(
**
data
)
class
LseekOutputSchema
(
Schema
):
"""Schema to deserialize the results of an lseek() execution"""
retval
=
fields
.
Integer
(
required
=
True
)
...
...
@@ -472,6 +505,7 @@ class IOParser:
'unlink'
:
UnlinkOutputSchema
(),
'access'
:
AccessOutputSchema
(),
'statfs'
:
StatfsOutputSchema
(),
'statvfs'
:
StatvfsOutputSchema
(),
# UTIL
'file_compare'
:
FileCompareOutputSchema
(),
'chdir'
:
ChdirOutputSchema
(),
...
...
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