From: Andres Beltran Date: Mon, 16 Jun 2025 23:44:35 +0000 (+0000) Subject: test: add test for quotas on Exec directories X-Git-Tag: v258-rc1~144^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F35892%2Fhead;p=thirdparty%2Fsystemd.git test: add test for quotas on Exec directories --- diff --git a/mkosi/mkosi.repart/20-disk.conf b/mkosi/mkosi.repart/20-disk.conf new file mode 100644 index 00000000000..0090dc00da4 --- /dev/null +++ b/mkosi/mkosi.repart/20-disk.conf @@ -0,0 +1,5 @@ +[Partition] +Type=linux-generic +Format=ext4 +SizeMinBytes=498M +SizeMaxBytes=498M diff --git a/test/units/TEST-07-PID1.quota.sh b/test/units/TEST-07-PID1.quota.sh new file mode 100755 index 00000000000..748b5ee6589 --- /dev/null +++ b/test/units/TEST-07-PID1.quota.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +# shellcheck disable=SC2016 +set -eux +set -o pipefail + +systemd-analyze log-level debug + +test_quotas() { + + local directory="$1" + local exec_directory_directive="$2" + local exec_quota_directive="$3" + local mountpoint="/datadrive" + + dev_num=$(lsblk | grep "498M" | awk '{print $1}' | sed 's/[^a-zA-Z0-9]*//g') + + if ! tune2fs -Q prjquota "/dev/${dev_num}"; then + return + fi + mkdir -p "${mountpoint}" + mount "/dev/${dev_num}" "${mountpoint}" + + mv /var/lib/ "${mountpoint}" + rm -rf /var/lib/ && ln -s "${mountpoint}/lib/" /var/ + + rm -rf "${directory}/quotadir" + + cat >/run/systemd/system/testservice-07-check-quotas.service </run/systemd/system/testservice-07-check-quotas.service <