1
0
mirror of https://github.com/systemd/systemd synced 2025-09-29 16:54:46 +02:00

Compare commits

..

No commits in common. "b10619484da4c61ca62898903fdb35ec56f9a282" and "fe3c1b0de66f8c9924e675706cc6142eb9d7d754" have entirely different histories.

86 changed files with 76 additions and 260 deletions

View File

@ -837,10 +837,8 @@
partition should be mounted. The second field specifies extra mount options to append to the default partition should be mounted. The second field specifies extra mount options to append to the default
mount options. These fields correspond to the second and fourth column of the mount options. These fields correspond to the second and fourth column of the
<citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry> <citerefentry project='man-pages'><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
format. As a colon is used for separating fields, each field needs to be quoted when it contains format. This setting may be specified multiple times to mount the partition multiple times. This can
colons. E.g. <programlisting>MountPoint="/path/with:colon":"zstd:1,noatime,lazytime"</programlisting> be used to add mounts for different
This setting may be specified multiple times to mount the partition multiple times. This can be used
to add mounts for different
<citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry> <citerefentry project="url"><refentrytitle url="https://btrfs.readthedocs.io/en/latest/btrfs.html">btrfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
subvolumes located on the same btrfs partition.</para> subvolumes located on the same btrfs partition.</para>

View File

@ -15,7 +15,6 @@
#include "strv.h" #include "strv.h"
#include "transaction.h" #include "transaction.h"
static bool job_matters_to_anchor(Job *job);
static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies); static void transaction_unlink_job(Transaction *tr, Job *j, bool delete_dependencies);
static void transaction_delete_job(Transaction *tr, Job *j, bool delete_dependencies) { static void transaction_delete_job(Transaction *tr, Job *j, bool delete_dependencies) {
@ -172,7 +171,6 @@ static int delete_one_unmergeable_job(Transaction *tr, Job *job) {
* another unit in which case we * another unit in which case we
* rather remove the start. */ * rather remove the start. */
/* Update test/units/TEST-87-AUX-UTILS-VM.sh when logs below are changed. */
log_unit_debug(j->unit, log_unit_debug(j->unit,
"Looking at job %s/%s conflicted_by=%s", "Looking at job %s/%s conflicted_by=%s",
j->unit->id, job_type_to_string(j->type), j->unit->id, job_type_to_string(j->type),
@ -218,18 +216,17 @@ static int delete_one_unmergeable_job(Transaction *tr, Job *job) {
return -EINVAL; return -EINVAL;
} }
static int transaction_ensure_mergeable(Transaction *tr, bool matters_to_anchor, sd_bus_error *e) { static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
Job *j; Job *j;
int r; int r;
assert(tr); assert(tr);
/* First step, check whether any of the jobs for one specific
* task conflict. If so, try to drop one of them. */
HASHMAP_FOREACH(j, tr->jobs) { HASHMAP_FOREACH(j, tr->jobs) {
JobType t; JobType t;
if (job_matters_to_anchor(j) != matters_to_anchor)
continue;
t = j->type; t = j->type;
LIST_FOREACH(transaction, k, j->transaction_next) { LIST_FOREACH(transaction, k, j->transaction_next) {
if (job_type_merge_and_collapse(&t, k->type, j->unit) >= 0) if (job_type_merge_and_collapse(&t, k->type, j->unit) >= 0)
@ -256,26 +253,7 @@ static int transaction_ensure_mergeable(Transaction *tr, bool matters_to_anchor,
} }
} }
return 0; /* Second step, merge the jobs. */
}
static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
Job *j;
int r;
assert(tr);
/* First step, try to drop unmergeable jobs for jobs that matter to anchor. */
r = transaction_ensure_mergeable(tr, /* matters_to_anchor = */ true, e);
if (r < 0)
return r;
/* Second step, do the same for jobs that not matter to anchor. */
r = transaction_ensure_mergeable(tr, /* matters_to_anchor = */ false, e);
if (r < 0)
return r;
/* Third step, merge the jobs. */
HASHMAP_FOREACH(j, tr->jobs) { HASHMAP_FOREACH(j, tr->jobs) {
JobType t = j->type; JobType t = j->type;

View File

@ -1422,9 +1422,6 @@ int unit_load_fragment_and_dropin(Unit *u, bool fragment_required) {
if (r < 0) if (r < 0)
return r; return r;
if (u->load_state == UNIT_MASKED)
return 0;
if (u->load_state == UNIT_STUB) { if (u->load_state == UNIT_STUB) {
if (fragment_required) if (fragment_required)
return -ENOENT; return -ENOENT;

View File

@ -7859,7 +7859,7 @@ static int context_fstab(Context *context) {
fputs(AUTOMATIC_FSTAB_HEADER_START "\n", f); fputs(AUTOMATIC_FSTAB_HEADER_START "\n", f);
LIST_FOREACH(partitions, p, context->partitions) { LIST_FOREACH(partitions, p, context->partitions) {
_cleanup_free_ char *what = NULL; _cleanup_free_ char *what = NULL, *options = NULL;
if (!need_fstab_one(p)) if (!need_fstab_one(p))
continue; continue;
@ -7869,8 +7869,6 @@ static int context_fstab(Context *context) {
return r; return r;
FOREACH_ARRAY(mountpoint, p->mountpoints, p->n_mountpoints) { FOREACH_ARRAY(mountpoint, p->mountpoints, p->n_mountpoints) {
_cleanup_free_ char *options = NULL;
r = partition_pick_mount_options( r = partition_pick_mount_options(
p->type.designator, p->type.designator,
p->format, p->format,

View File

@ -3283,7 +3283,7 @@ static int split_pattern_into_name_and_instances(const char *pattern, char **out
return 0; return 0;
} }
static int presets_find_config(RuntimeScope scope, const char *root_dir, char ***ret) { static int presets_find_config(RuntimeScope scope, const char *root_dir, char ***files) {
static const char* const initrd_dirs[] = { CONF_PATHS("systemd/initrd-preset"), NULL }; static const char* const initrd_dirs[] = { CONF_PATHS("systemd/initrd-preset"), NULL };
static const char* const system_dirs[] = { CONF_PATHS("systemd/system-preset"), NULL }; static const char* const system_dirs[] = { CONF_PATHS("systemd/system-preset"), NULL };
static const char* const user_dirs[] = { CONF_PATHS("systemd/user-preset"), NULL }; static const char* const user_dirs[] = { CONF_PATHS("systemd/user-preset"), NULL };
@ -3298,26 +3298,13 @@ static int presets_find_config(RuntimeScope scope, const char *root_dir, char **
if (r < 0 && r != -ENOENT) if (r < 0 && r != -ENOENT)
return r; return r;
/* Make sure that we fall back to the system preset directories if we're operating on a root dirs = r >= 0 ? initrd_dirs : system_dirs;
* directory without initrd preset directories. This makes sure that we don't regress when
* using a newer systemctl to operate on a root directory with an older version of systemd
* installed that doesn't yet known about initrd preset directories. */
if (r >= 0)
STRV_FOREACH(d, initrd_dirs) {
r = chase_and_access(*d, root_dir, CHASE_PREFIX_ROOT, F_OK, /* ret_path= */ NULL);
if (r >= 0)
return conf_files_list_strv(ret, ".preset", root_dir, 0, initrd_dirs);
if (r != -ENOENT)
return r;
}
dirs = system_dirs;
} else if (IN_SET(scope, RUNTIME_SCOPE_GLOBAL, RUNTIME_SCOPE_USER)) } else if (IN_SET(scope, RUNTIME_SCOPE_GLOBAL, RUNTIME_SCOPE_USER))
dirs = user_dirs; dirs = user_dirs;
else else
assert_not_reached(); assert_not_reached();
return conf_files_list_strv(ret, ".preset", root_dir, 0, dirs); return conf_files_list_strv(files, ".preset", root_dir, 0, dirs);
} }
static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePresets *presets) { static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePresets *presets) {

View File

@ -32,7 +32,7 @@ TEST_RET(cgroup_mask, .sd_booted = true) {
/* Prepare the manager. */ /* Prepare the manager. */
_cleanup_free_ char *unit_dir = NULL; _cleanup_free_ char *unit_dir = NULL;
ASSERT_OK(get_testdata_dir("test-cgroup-mask", &unit_dir)); ASSERT_OK(get_testdata_dir("units", &unit_dir));
ASSERT_OK(setenv_unit_path(unit_dir)); ASSERT_OK(setenv_unit_path(unit_dir));
assert_se(runtime_dir = setup_fake_runtime_dir()); assert_se(runtime_dir = setup_fake_runtime_dir());
r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);

View File

@ -21,7 +21,7 @@ TEST_RET(default_memory_low, .sd_booted = true) {
return log_tests_skipped("cgroupfs not available"); return log_tests_skipped("cgroupfs not available");
_cleanup_free_ char *unit_dir = NULL; _cleanup_free_ char *unit_dir = NULL;
ASSERT_OK(get_testdata_dir("test-cgroup-unit-default", &unit_dir)); ASSERT_OK(get_testdata_dir("units", &unit_dir));
ASSERT_OK(setenv_unit_path(unit_dir)); ASSERT_OK(setenv_unit_path(unit_dir));
assert_se(runtime_dir = setup_fake_runtime_dir()); assert_se(runtime_dir = setup_fake_runtime_dir());
r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m);

View File

@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
/* prepare the test */ /* prepare the test */
_cleanup_free_ char *unit_dir = NULL; _cleanup_free_ char *unit_dir = NULL;
ASSERT_OK(get_testdata_dir("test-engine", &unit_dir)); ASSERT_OK(get_testdata_dir("units", &unit_dir));
ASSERT_OK(setenv_unit_path(unit_dir)); ASSERT_OK(setenv_unit_path(unit_dir));
assert_se(runtime_dir = setup_fake_runtime_dir()); assert_se(runtime_dir = setup_fake_runtime_dir());

View File

@ -25,7 +25,7 @@ int main(int argc, char *argv[]) {
/* prepare the test */ /* prepare the test */
_cleanup_free_ char *unit_dir = NULL; _cleanup_free_ char *unit_dir = NULL;
ASSERT_OK(get_testdata_dir("test-sched-prio", &unit_dir)); ASSERT_OK(get_testdata_dir("units", &unit_dir));
ASSERT_OK(setenv_unit_path(unit_dir)); ASSERT_OK(setenv_unit_path(unit_dir));
assert_se(runtime_dir = setup_fake_runtime_dir()); assert_se(runtime_dir = setup_fake_runtime_dir());

View File

@ -8,4 +8,4 @@ StartLimitBurst=15
StartLimitIntervalSec=1h StartLimitIntervalSec=1h
[Service] [Service]
ExecStart=/usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-short-lived.sh ExecStart=/usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-short-lived.sh

View File

@ -339,18 +339,15 @@ if install_tests
'auxv', 'auxv',
'journal-data', 'journal-data',
'knot-data', 'knot-data',
'test-cgroup-mask', 'test-journals',
'test-cgroup-unit-default', 'units',
'test-engine',
'test-execute', 'test-execute',
'test-fstab-generator', 'test-fstab-generator',
'test-journals',
'test-network',
'test-network-generator-conversion',
'test-path', 'test-path',
'test-path-util', 'test-path-util',
'test-sched-prio',
'test-umount', 'test-umount',
'test-network',
'test-network-generator-conversion',
'integration-tests/TEST-07-PID1/TEST-07-PID1.units', 'integration-tests/TEST-07-PID1/TEST-07-PID1.units',
'integration-tests/TEST-03-JOBS/TEST-03-JOBS.units', 'integration-tests/TEST-03-JOBS/TEST-03-JOBS.units',
'integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units', 'integration-tests/TEST-04-JOURNAL/TEST-04-JOURNAL.units',
@ -358,15 +355,9 @@ if install_tests
'integration-tests/TEST-16-EXTEND-TIMEOUT/TEST-16-EXTEND-TIMEOUT.units', 'integration-tests/TEST-16-EXTEND-TIMEOUT/TEST-16-EXTEND-TIMEOUT.units',
'integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units', 'integration-tests/TEST-23-UNIT-FILE/TEST-23-UNIT-FILE.units',
'integration-tests/TEST-30-ONCLOCKCHANGE/TEST-30-ONCLOCKCHANGE.units', 'integration-tests/TEST-30-ONCLOCKCHANGE/TEST-30-ONCLOCKCHANGE.units',
'integration-tests/TEST-38-FREEZER/TEST-38-FREEZER.units',
'integration-tests/TEST-52-HONORFIRSTSHUTDOWN/TEST-52-HONORFIRSTSHUTDOWN.units', 'integration-tests/TEST-52-HONORFIRSTSHUTDOWN/TEST-52-HONORFIRSTSHUTDOWN.units',
'integration-tests/TEST-55-OOMD/TEST-55-OOMD.units',
'integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units',
'integration-tests/TEST-63-PATH/TEST-63-PATH.units', 'integration-tests/TEST-63-PATH/TEST-63-PATH.units',
'integration-tests/TEST-65-ANALYZE/TEST-65-ANALYZE.units',
'integration-tests/TEST-66-DEVICE-ISOLATION/TEST-66-DEVICE-ISOLATION.units',
'integration-tests/TEST-80-NOTIFYACCESS/TEST-80-NOTIFYACCESS.units', 'integration-tests/TEST-80-NOTIFYACCESS/TEST-80-NOTIFYACCESS.units',
'units',
] ]
foreach subdir : testdata_subdirs foreach subdir : testdata_subdirs

View File

@ -1,90 +0,0 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
set -o pipefail
at_exit() {
set +e
systemctl stop mask-test.service
rm -rf /run/systemd/system/mask-test.service*
systemctl daemon-reload
rm -f /tmp/should-not-exist-by-*
}
trap at_exit EXIT
rm -f /tmp/should-not-exist-by-*
mkdir -p /run/systemd/system/mask-test.service.d
cat >/run/systemd/system/mask-test.service <<EOF
[Service]
Type=exec
ExecStart=sleep infinity
ExecStop=touch /tmp/should-not-exist-by-main
EOF
# Check if ExecStop= and friends in a masked unit are not executed even defined
# in drop-in. See issue #38802.
cat >/run/systemd/system/mask-test.service.d/10-stop.conf <<EOF
[Service]
ExecStop=touch /tmp/should-not-exist-by-dropin
EOF
systemctl daemon-reload
[[ "$(systemctl is-enabled mask-test.service || :)" == static ]]
systemctl start mask-test.service
[[ "$(systemctl is-active mask-test.service || :)" == active ]]
# When not masked, of course ExecStop= are executed.
systemctl stop mask-test.service
[[ "$(systemctl is-active mask-test.service || :)" == inactive ]]
[[ -f /tmp/should-not-exist-by-main ]]
[[ -f /tmp/should-not-exist-by-dropin ]]
rm -f /tmp/should-not-exist-by-*
systemctl start mask-test.service
[[ "$(systemctl is-active mask-test.service || :)" == active ]]
# Check if mask --now works and ExecStop= are not executed.
systemctl mask --now mask-test.service
[[ "$(systemctl is-enabled mask-test.service || :)" == masked ]]
[[ "$(systemctl is-active mask-test.service || :)" == inactive ]]
[[ ! -f /tmp/should-not-exist-by-main ]]
[[ ! -f /tmp/should-not-exist-by-dropin ]]
systemctl unmask mask-test.service
[[ "$(systemctl is-enabled mask-test.service || :)" == static ]]
systemctl start mask-test.service
[[ "$(systemctl is-active mask-test.service || :)" == active ]]
systemctl mask mask-test.service
[[ "$(systemctl is-enabled mask-test.service || :)" == masked ]]
[[ "$(systemctl is-active mask-test.service || :)" == active ]]
# Check if mask --now for already masked unit stops the service.
systemctl mask --now mask-test.service
[[ "$(systemctl is-enabled mask-test.service || :)" == masked ]]
[[ "$(systemctl is-active mask-test.service || :)" == inactive ]]
[[ ! -f /tmp/should-not-exist-by-main ]]
[[ ! -f /tmp/should-not-exist-by-dropin ]]
systemctl unmask mask-test.service
[[ "$(systemctl is-enabled mask-test.service || :)" == static ]]
systemctl start mask-test.service
[[ "$(systemctl is-active mask-test.service || :)" == active ]]
systemctl mask mask-test.service
[[ "$(systemctl is-enabled mask-test.service || :)" == masked ]]
[[ "$(systemctl is-active mask-test.service || :)" == active ]]
# Check if already masked unit can be stopped.
systemctl stop mask-test.service
[[ "$(systemctl is-active mask-test.service || :)" == inactive ]]
[[ ! -f /tmp/should-not-exist-by-main ]]
[[ ! -f /tmp/should-not-exist-by-dropin ]]

View File

@ -4,7 +4,7 @@ set -eux
set -o pipefail set -o pipefail
# shellcheck source=test/units/util.sh # shellcheck source=test/units/util.sh
. "$(dirname "$0")"/../units/util.sh . "$(dirname "$0")"/util.sh
assert_eq "$LISTEN_FDS" "$1" assert_eq "$LISTEN_FDS" "$1"
assert_eq "$LISTEN_FDNAMES" "$2" assert_eq "$LISTEN_FDNAMES" "$2"

View File

@ -4,7 +4,7 @@ set -eux
set -o pipefail set -o pipefail
# shellcheck source=test/units/util.sh # shellcheck source=test/units/util.sh
. "$(dirname "$0")"/../units/util.sh . "$(dirname "$0")"/util.sh
assert_eq "$LISTEN_FDS" "$1" assert_eq "$LISTEN_FDS" "$1"
assert_eq "$LISTEN_FDNAMES" "$2" assert_eq "$LISTEN_FDNAMES" "$2"

View File

@ -31,8 +31,8 @@ busctl call \
org.freedesktop.systemd1.Manager StartTransientUnit \ org.freedesktop.systemd1.Manager StartTransientUnit \
"ssa(sv)a(sa(sv))" "$TEST_UNIT" replace 4 \ "ssa(sv)a(sa(sv))" "$TEST_UNIT" replace 4 \
ExecStart "a(sasb)" 1 \ ExecStart "a(sasb)" 1 \
/usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh \ /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh \
5 /usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh 2 "test:other" "Hello" "Extra" \ 5 /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-ExtraFileDescriptors-child.sh 2 "test:other" "Hello" "Extra" \
true \ true \
RemainAfterExit "b" true \ RemainAfterExit "b" true \
Type "s" oneshot \ Type "s" oneshot \

View File

@ -28,7 +28,7 @@ systemd-run -p DynamicUser=yes -p EnvironmentFile=-/usr/lib/systemd/systemd-asan
-p RemainAfterExit=yes \ -p RemainAfterExit=yes \
--unit=test-23-openfile-existing.service \ --unit=test-23-openfile-existing.service \
--service-type=oneshot \ --service-type=oneshot \
/usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-openfile-child.sh 2 "open.txt:colon" "Open" "File" /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-openfile-child.sh 2 "open.txt:colon" "Open" "File"
cmp <(systemctl show -p OpenFile test-23-openfile-existing.service) <<EOF cmp <(systemctl show -p OpenFile test-23-openfile-existing.service) <<EOF
OpenFile=/tmp/test-open-file/open.txt::read-only OpenFile=/tmp/test-open-file/open.txt::read-only
@ -43,7 +43,7 @@ systemctl start TEST-23-UNIT-FILE-openfile-server.socket
systemd-run -p OpenFile=/tmp/test.sock:socket:read-only \ systemd-run -p OpenFile=/tmp/test.sock:socket:read-only \
--wait \ --wait \
/usr/lib/systemd/tests/testdata/TEST-23-UNIT-FILE.units/TEST-23-UNIT-FILE-openfile-child.sh 1 "socket" "Socket" /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE-openfile-child.sh 1 "socket" "Socket"
systemctl stop TEST-23-UNIT-FILE-openfile-server.socket systemctl stop TEST-23-UNIT-FILE-openfile-server.socket

View File

@ -1375,16 +1375,6 @@ EOF
assert_in "${loop}p3 : start= *${start}, size= *${size}, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=DB081670-07AE-48CA-9F5E-813D5E40B976, name=\"linux-generic-2\"" "$output" assert_in "${loop}p3 : start= *${start}, size= *${size}, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=DB081670-07AE-48CA-9F5E-813D5E40B976, name=\"linux-generic-2\"" "$output"
} }
testcase_sector() {
# Valid block sizes on the Linux block layer are >= 512 and <= PAGE_SIZE, and
# must be powers of 2. Which leaves exactly four different ones to test on
# typical hardware
test_sector 512
test_sector 1024
test_sector 2048
test_sector 4096
}
testcase_dropped_partitions() { testcase_dropped_partitions() {
local workdir image defs local workdir image defs
@ -1628,57 +1618,6 @@ EOF
assert_in "${image}2 : start= 286680, size= 532480, type=${esp_guid}" "$output" assert_in "${image}2 : start= 286680, size= 532480, type=${esp_guid}" "$output"
} }
testcase_btrfs() {
local defs imgs output root
if ! systemd-analyze compare-versions "$(btrfs --version | head -n 1 | awk '{ print $2 }')" ge v6.12; then
echo "btrfs-progs is not installed or older than v6.12, skipping test."
return 0
fi
if [[ "$OFFLINE" != "yes" ]]; then
return 0
fi
defs="$(mktemp --directory "/tmp/test-repart.defs.XXXXXXXXXX")"
imgs="$(mktemp --directory "/var/tmp/test-repart.imgs.XXXXXXXXXX")"
root="$(mktemp --directory "/var/test-repart.root.XXXXXXXXXX")"
# shellcheck disable=SC2064
trap "rm -rf '$defs' '$imgs' '$root'" RETURN
chmod 0755 "$defs"
echo "*** testcase for btrfs ***"
tee "$defs/root.conf" <<EOF
[Partition]
Type=root
Format=btrfs
MakeDirectories=/@ /@home
Subvolumes=/@ /@home
DefaultSubvolume=/@
MountPoint=/:"subvol=@,zstd:1,noatime,lazytime"
MountPoint=/home:"subvol=@home,zstd:1,noatime,lazytime"
EOF
mkdir -p "$root"/etc
systemd-repart --pretty=yes \
--definitions "$defs" \
--empty=create \
--size=1G \
--seed="$seed" \
--dry-run=no \
--offline=yes \
--generate-fstab "$root"/etc/fstab \
"$imgs/btrfs.img"
sfdisk --dump "$imgs/btrfs.img"
cat "$root"/etc/fstab
grep -q 'UUID=[0-9a-f-]* / btrfs discard,rw,nodev,suid,exec,subvol=@,zstd:1,noatime,lazytime 0 1' "$root"/etc/fstab
grep -q 'UUID=[0-9a-f-]* /home btrfs discard,rw,nodev,suid,exec,subvol=@home,zstd:1,noatime,lazytime 0 1' "$root"/etc/fstab
}
OFFLINE="yes" OFFLINE="yes"
run_testcases run_testcases
@ -1688,4 +1627,12 @@ if ! systemd-detect-virt --container; then
run_testcases run_testcases
fi fi
# Valid block sizes on the Linux block layer are >= 512 and <= PAGE_SIZE, and
# must be powers of 2. Which leaves exactly four different ones to test on
# typical hardware
test_sector 512
test_sector 1024
test_sector 2048
test_sector 4096
touch /testok touch /testok

View File

@ -510,12 +510,6 @@ systemd-analyze verify /tmp/testwarnings.service
rm /tmp/testwarnings.service rm /tmp/testwarnings.service
TESTDATA=/usr/lib/systemd/tests/testdata/TEST-65-ANALYZE.units
systemd-analyze verify "${TESTDATA}/loopy.service"
systemd-analyze verify "${TESTDATA}/loopy2.service"
systemd-analyze verify "${TESTDATA}/loopy3.service"
systemd-analyze verify "${TESTDATA}/loopy4.service"
# Added an additional "INVALID_ID" id to the .json to verify that nothing breaks when input is malformed # Added an additional "INVALID_ID" id to the .json to verify that nothing breaks when input is malformed
# The PrivateNetwork id description and weight was changed to verify that 'security' is actually reading in # The PrivateNetwork id description and weight was changed to verify that 'security' is actually reading in
# values from the .json file when required. The default weight for "PrivateNetwork" is 2500, and the new weight # values from the .json file when required. The default weight for "PrivateNetwork" is 2500, and the new weight

View File

@ -177,10 +177,6 @@ rm -fv /run/systemd/coredump.conf.d/99-external.conf
# Wait a bit for the coredumps to get processed # Wait a bit for the coredumps to get processed
timeout 30 bash -c "while [[ \$(coredumpctl list -q --no-legend $CORE_TEST_UNPRIV_BIN | wc -l) -lt 4 ]]; do sleep 1; done" timeout 30 bash -c "while [[ \$(coredumpctl list -q --no-legend $CORE_TEST_UNPRIV_BIN | wc -l) -lt 4 ]]; do sleep 1; done"
# Sync and rotate journal again to make the coredump stored in an archived journal.
journalctl --sync
journalctl --rotate
# root should see coredumps from both binaries # root should see coredumps from both binaries
coredumpctl info "$CORE_TEST_UNPRIV_BIN" coredumpctl info "$CORE_TEST_UNPRIV_BIN"
coredumpctl info "${CORE_TEST_UNPRIV_BIN##*/}" coredumpctl info "${CORE_TEST_UNPRIV_BIN##*/}"

View File

@ -3,14 +3,6 @@
set -eux set -eux
set -o pipefail set -o pipefail
# For issue #38765
journalctl --sync
if journalctl -q -o short-monotonic --grep "Looking at job .*/.* conflicted_by=(yes|no)" >/failed; then
echo "Found unexpected unmergeable jobs"
cat /failed
exit 1
fi
# shellcheck source=test/units/test-control.sh # shellcheck source=test/units/test-control.sh
. "$(dirname "$0")"/test-control.sh . "$(dirname "$0")"/test-control.sh

View File

@ -1,15 +1,4 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
# We use a custom autorelabel service instead of the SELinux provided set of
# units & a generator, since the generator overrides the default target to the
# SELinux one when it detects /.autorelabel. However, we use systemd.unit= on
# the kernel command cmdline which always takes precedence, rendering all
# SELinux efforts useless. Also, pulling in selinux-autorelabel.service
# explicitly doesn't work either, as it doesn't check for the presence of
# /.autorelabel and does the relabeling unconditionally which always ends with
# a reboot, so we end up in a reboot loop (and it also spews quite a lot of
# errors as it wants /etc/fstab and dracut-initramfs-restore).
[Unit] [Unit]
Description=Relabel all filesystems Description=Relabel all filesystems
DefaultDependencies=no DefaultDependencies=no

View File

@ -0,0 +1,14 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Shutdown
Documentation=man:systemd.special(7)
DefaultDependencies=no
RefuseManualStart=yes

12
test/units/sockets.target Normal file
View File

@ -0,0 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Sockets
Documentation=man:systemd.special(7)

View File

@ -10,8 +10,6 @@
[Unit] [Unit]
Description=System Initialization Description=System Initialization
Documentation=man:systemd.special(7) Documentation=man:systemd.special(7)
Wants=local-fs.target swap.target
After=local-fs.target swap.target
Conflicts=emergency.service emergency.target Conflicts=emergency.service emergency.target
Before=emergency.service emergency.target Wants=local-fs.target swap.target
After=local-fs.target swap.target emergency.service emergency.target

15
test/units/timers.target Normal file
View File

@ -0,0 +1,15 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Timers
Documentation=man:systemd.special(7)
DefaultDependencies=no
Conflicts=shutdown.target