Skip to content
GitLab
Explore
Sign in
Show whitespace changes
Inline
Side-by-side
tests/integration/operations/test_read_operations.py
View file @
5c0ec2a1
...
...
@@ -192,3 +192,131 @@ def test_preadv(gkfs_daemon, gkfs_client):
assert
ret
.
buf_0
==
buf_0
assert
ret
.
buf_1
==
buf_1
assert
ret
.
retval
==
len
(
buf_0
)
+
len
(
buf_1
)
# Return the number of read bytes
def
test_read_libc
(
gkfs_daemon
,
gkfs_clientLibc
):
file
=
gkfs_daemon
.
mountdir
/
"
file
"
# create a file in gekkofs
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# write a buffer we know
buf
=
b
'
42
'
ret
=
gkfs_clientLibc
.
write
(
file
,
buf
,
len
(
buf
))
assert
ret
.
retval
==
len
(
buf
)
# Return the number of written bytes
# open the file to read
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_RDONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# read the file
ret
=
gkfs_clientLibc
.
read
(
file
,
len
(
buf
))
assert
ret
.
buf
==
buf
assert
ret
.
retval
==
len
(
buf
)
# Return the number of read bytes
def
test_pread_libc
(
gkfs_daemon
,
gkfs_clientLibc
):
file
=
gkfs_daemon
.
mountdir
/
"
file
"
# create a file in gekkofs
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# write a buffer we know
buf
=
b
'
42
'
ret
=
gkfs_clientLibc
.
pwrite
(
file
,
buf
,
len
(
buf
),
1024
)
assert
ret
.
retval
==
len
(
buf
)
# Return the number of written bytes
# open the file to read
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_RDONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# read the file at offset 1024
ret
=
gkfs_clientLibc
.
pread
(
file
,
len
(
buf
),
1024
)
assert
ret
.
buf
==
buf
assert
ret
.
retval
==
len
(
buf
)
# Return the number of read bytes
@pytest.mark.skip
(
reason
=
"
readv not implemented in libc
"
)
def
test_readv_libc
(
gkfs_daemon
,
gkfs_clientLibc
):
file
=
gkfs_daemon
.
mountdir
/
"
file
"
# create a file in gekkofs
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# write a buffer we know
buf_0
=
b
'
42
'
buf_1
=
b
'
24
'
ret
=
gkfs_clientLibc
.
writev
(
file
,
buf_0
,
buf_1
,
2
)
assert
ret
.
retval
==
len
(
buf_0
)
+
len
(
buf_1
)
# Return the number of written bytes
# open the file to read
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_RDONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# read the file
ret
=
gkfs_clientLibc
.
readv
(
file
,
len
(
buf_0
),
len
(
buf_1
))
assert
ret
.
buf_0
==
buf_0
assert
ret
.
buf_1
==
buf_1
assert
ret
.
retval
==
len
(
buf_0
)
+
len
(
buf_1
)
# Return the number of read bytes
@pytest.mark.skip
(
reason
=
"
preadv not implemented in libc
"
)
def
test_preadv_libc
(
gkfs_daemon
,
gkfs_clientLibc
):
file
=
gkfs_daemon
.
mountdir
/
"
file
"
# create a file in gekkofs
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# write a buffer we know
buf_0
=
b
'
42
'
buf_1
=
b
'
24
'
ret
=
gkfs_clientLibc
.
pwritev
(
file
,
buf_0
,
buf_1
,
2
,
1024
)
assert
ret
.
retval
==
len
(
buf_0
)
+
len
(
buf_1
)
# Return the number of written bytes
# open the file to read
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_RDONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
# read the file
ret
=
gkfs_clientLibc
.
preadv
(
file
,
len
(
buf_0
),
len
(
buf_1
),
1024
)
assert
ret
.
buf_0
==
buf_0
assert
ret
.
buf_1
==
buf_1
assert
ret
.
retval
==
len
(
buf_0
)
+
len
(
buf_1
)
# Return the number of read bytes
\ No newline at end of file
tests/integration/operations/test_write_operations.py
View file @
5c0ec2a1
...
...
@@ -129,6 +129,53 @@ def test_write_proxy(gkfs_daemon_proxy, gkfs_proxy, gkfs_client_proxy):
assert
ret
.
retval
==
0
assert
ret
.
statbuf
.
st_size
==
(
len
(
str1
)
+
len
(
str2
)
+
len
(
str3
))
def
test_write_libc
(
gkfs_daemon
,
gkfs_clientLibc
):
file
=
gkfs_daemon
.
mountdir
/
"
file
"
ret
=
gkfs_clientLibc
.
open
(
file
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
buf
=
b
'
42
'
ret
=
gkfs_clientLibc
.
write
(
file
,
buf
,
len
(
buf
))
assert
ret
.
retval
==
len
(
buf
)
# Return the number of written bytes
file_append
=
gkfs_daemon
.
mountdir
/
"
file_append
"
ret
=
gkfs_clientLibc
.
open
(
file_append
,
os
.
O_CREAT
|
os
.
O_WRONLY
|
os
.
O_APPEND
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
str1
=
b
'
Hello
'
str2
=
b
'
, World!
'
str3
=
b
'
This is a test.
\n
'
ret
=
gkfs_clientLibc
.
write
(
file_append
,
str1
,
len
(
str1
),
True
)
assert
ret
.
retval
==
len
(
str1
)
ret
=
gkfs_clientLibc
.
stat
(
file_append
)
assert
ret
.
retval
==
0
assert
ret
.
statbuf
.
st_size
==
len
(
str1
)
ret
=
gkfs_clientLibc
.
write
(
file_append
,
str2
,
len
(
str2
),
True
)
assert
ret
.
retval
==
len
(
str2
)
ret
=
gkfs_clientLibc
.
stat
(
file_append
)
assert
ret
.
retval
==
0
assert
ret
.
statbuf
.
st_size
==
(
len
(
str1
)
+
len
(
str2
))
ret
=
gkfs_clientLibc
.
write
(
file_append
,
str3
,
len
(
str3
),
True
)
assert
ret
.
retval
==
len
(
str3
)
ret
=
gkfs_clientLibc
.
stat
(
file_append
)
assert
ret
.
retval
==
0
assert
ret
.
statbuf
.
st_size
==
(
len
(
str1
)
+
len
(
str2
)
+
len
(
str3
))
def
test_pwrite
(
gkfs_daemon
,
gkfs_client
):
file
=
gkfs_daemon
.
mountdir
/
"
file
"
...
...
tests/integration/requirements.txt.in
View file @
5c0ec2a1
...
...
@@ -2,7 +2,7 @@ apipkg==1.5
attrs==19.3.0
backcall==0.1.0
decorator==4.4.1
execnet==
1.7
.1
execnet==
2.1
.1
importlib-metadata==1.5.0
iniconfig==1.1.1
ipython==7.12.0
...
...
@@ -17,16 +17,16 @@ packaging==20.1
parso==0.6.1
pexpect==4.8.0
pickleshare==0.7.5
pluggy==
0.13.1
pluggy==
1.5.0
prompt-toolkit==3.0.3
ptyprocess==0.6.0
py==1.11.0
Pygments==2.5.2
pyparsing==2.4.6
pytest==
6.2.5
pytest==
8.3.3
pytest-dependency==0.5.1
pytest-forked==1.1.3
pytest-xdist==
1.31.0
pytest-xdist==
3.6.1
sh==1.14.3
six==1.14.0
toml==0.10.2
...
...
tests/integration/shell/test_concat.py
View file @
5c0ec2a1
tests/integration/shell/test_stat.py
View file @
5c0ec2a1
...
...
@@ -58,7 +58,34 @@ def test_shell_if_e(gkfs_daemon, gkfs_shell, file_factory):
assert
cmd
.
exit_code
==
0
@pytest.mark.skip
(
reason
=
"
shell tests seem to hang clients at times
"
)
#@pytest.mark.skip(reason="shell tests seem to hang clients at times")
def
test_shell_if_e_libc
(
gkfs_daemon
,
gkfs_shellLibc
,
file_factory
):
"""
Copy a file into gkfs using the shell and check that it
exists using `if [[ -e <file> ]]`.
"""
logger
.
info
(
"
creating input file
"
)
lf01
=
file_factory
.
create
(
file01
,
size
=
4.0
,
unit
=
'
MB
'
)
logger
.
info
(
"
copying into gkfs
"
)
cmd
=
gkfs_shellLibc
.
cp
(
lf01
.
pathname
,
gkfs_daemon
.
mountdir
)
assert
cmd
.
exit_code
==
0
logger
.
info
(
"
checking if file exists
"
)
cmd
=
gkfs_shellLibc
.
script
(
f
"""
expected_pathname=
{
gkfs_daemon
.
mountdir
/
file01
}
if [[ -e ${{expected_pathname}} ]];
then
exit 0
fi
exit 1
"""
)
assert
cmd
.
exit_code
==
0
##@pytest.mark.skip(reason="shell tests seem to hang clients at times")
def
test_stat_script
(
gkfs_daemon
,
gkfs_shell
,
file_factory
):
"""
Copy a file into gkfs using the shell and check that it
...
...
Prev
1
2
3
Next