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
e3ff9bd3
Commit
e3ff9bd3
authored
May 17, 2022
by
Ramon Nou
Browse files
Truncate errors test
parent
3574e007
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
e3ff9bd3
...
...
@@ -50,11 +50,11 @@ gkfs:
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"
-
sed -i 's/\/\/constexpr auto use_atime =
false
;/constexpr auto use_atime =
true
;/g' "${CI_PROJECT_DIR}/src/
include/
config.hpp"
-
sed -i 's/\/\/constexpr auto use_ctime =
false
;/constexpr auto use_ctime =
true
;/g' "${CI_PROJECT_DIR}/src/
include/
config.hpp"
-
sed -i 's/\/\/constexpr auto use_mtime =
false
;/constexpr auto use_mtime =
true
;/g' "${CI_PROJECT_DIR}/src/
include/
config.hpp"
-
sed -i 's/\/\/constexpr auto use_link_cnt =
false
;/constexpr auto use_link_cnt =
true
;/g' "${CI_PROJECT_DIR}/src/
include/
config.hpp"
-
sed -i 's/\/\/constexpr auto use_blocks =
false
;/constexpr auto use_blocks =
true
;/g' "${CI_PROJECT_DIR}/src/
include/
config.hpp"
-
mkdir -p ${BUILD_PATH} && cd ${BUILD_PATH}
-
cmake
-Wdev
...
...
tests/integration/data/test_truncate.py
View file @
e3ff9bd3
...
...
@@ -30,6 +30,7 @@
# from pathlib import Path
import
os
import
stat
import
errno
# @pytest.mark.xfail(reason="invalid errno returned on success")
...
...
@@ -121,3 +122,35 @@ def test_truncate(gkfs_daemon, gkfs_client):
ret
=
gkfs_client
.
file_compare
(
truncfile
,
truncfile_verify_2
,
trunc_size
)
assert
ret
.
retval
==
0
# Tests failure cases
def
test_fail_truncate
(
gkfs_daemon
,
gkfs_client
):
truncfile
=
gkfs_daemon
.
mountdir
/
"trunc_file2"
# open and create test file
ret
=
gkfs_client
.
open
(
truncfile
,
os
.
O_CREAT
|
os
.
O_WRONLY
,
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
assert
ret
.
retval
!=
-
1
buf_length
=
256
ret
=
gkfs_client
.
write_random
(
truncfile
,
buf_length
)
assert
ret
.
retval
==
buf_length
ret
=
gkfs_client
.
truncate
(
truncfile
,
buf_length
)
assert
ret
.
retval
==
0
# Size should not change
ret
=
gkfs_client
.
stat
(
truncfile
)
assert
ret
.
statbuf
.
st_size
==
buf_length
# Truncate to a negative size
ret
=
gkfs_client
.
truncate
(
truncfile
,
-
1
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
EINVAL
# Truncate to a size greater than the file size
ret
=
gkfs_client
.
truncate
(
truncfile
,
buf_length
+
1
)
assert
ret
.
retval
==
-
1
assert
ret
.
errno
==
errno
.
EINVAL
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