diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-10-19 12:28:37 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-10-19 19:01:07 +0200 |
commit | a2dd5920021ab2f7ea41e3d517956524cfbe9c64 (patch) | |
tree | d074ebfd236e725e9e3593d4487a4d0200877045 /test/units/util.sh | |
parent | meson: generate proper version tag when git fails on permission errors (diff) | |
download | systemd-a2dd5920021ab2f7ea41e3d517956524cfbe9c64.tar.xz systemd-a2dd5920021ab2f7ea41e3d517956524cfbe9c64.zip |
test: unify checking for user xattrs support in cgroupfs
Also, run the coredump forwarding test only if user xattrs are
supported.
Diffstat (limited to 'test/units/util.sh')
-rwxr-xr-x | test/units/util.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/units/util.sh b/test/units/util.sh index 8a01c5c07a..fee642fa9d 100755 --- a/test/units/util.sh +++ b/test/units/util.sh @@ -171,3 +171,14 @@ systemctl_final() { systemctl "$@" } + +cgroupfs_supports_user_xattrs() { + local xattr + + xattr="user.supported_$RANDOM" + # shellcheck disable=SC2064 + trap "setfattr --remove=$xattr /sys/fs/cgroup || :" RETURN + + setfattr --name="$xattr" --value=254 /sys/fs/cgroup + [[ "$(getfattr --name="$xattr" --absolute-names --only-values /sys/fs/cgroup)" -eq 254 ]] +} |