1
0
mirror of https://github.com/systemd/systemd synced 2025-09-29 00:34:45 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
172e8cf505
Merge pull request #18365 from DaanDeMeyer/update-man-rules-mkosi
Fix update-man-rules usage with mkosi
2021-01-25 14:05:56 +01:00
Zbigniew Jędrzejewski-Szmek
fc9fd800e8 libsystemd: fix typo in symbol versioning 2021-01-25 11:50:28 +00:00
Zbigniew Jędrzejewski-Szmek
6dcf299d9b
Merge pull request #18363 from bluca/test_image_reuse
tests: build the image once and then copy/extend it
2021-01-25 09:25:56 +01:00
Daan De Meyer
44bc7f4fcf meson: Fix update-man-rules when the build dir is not a subdir of the project dir
Until now, update-man-rules assumed that the build directory was
a subdirectory of the project directory. When using mkosi, this is
not the case. We use find instead of git ls-files because git ls-files
does not seem to support outputting absolute paths.

Also, this makes update-man-rules a bit more user-friendly as new manpages
don't have to be added to the git staging area before they are processed by
update-man-rules.py.
2021-01-24 17:33:49 +00:00
Daan De Meyer
5a89c7972a mkosi: Pass build script arguments to ninja
mkosi recently gained support to pass arguments to the build script.
Let's take advantage of this in systemd's build script to allow
passing which target to build to ninja in the build script.
2021-01-24 14:13:02 +00:00
Luca Boccassi
d9e606e89f tests: build the image once and then copy/extend it
Building custom images for each test takes a lot of time.
Build the default one, and if the test needs incompatible changes
just copy it and extend it instead.
2021-01-24 13:07:39 +00:00
Luca Boccassi
74eec54d66 test: note where the bionic-* CI tool/integration lives 2021-01-24 12:03:53 +00:00
13 changed files with 70 additions and 98 deletions

View File

@ -217,16 +217,14 @@ endif
############################################################
if git.found()
custom_target(
'update-man-rules',
output : 'update-man-rules',
command : ['sh', '-c',
'cd @0@ && '.format(meson.build_root()) +
'python3 @0@/tools/update-man-rules.py $(git ls-files ":/man/*.xml") >t && '.format(project_source_root) +
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
depend_files : custom_entities_ent)
endif
custom_target(
'update-man-rules',
output : 'update-man-rules',
command : ['sh', '-c',
'cd @0@ && '.format(meson.build_root()) +
'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
depend_files : custom_entities_ent)
############################################################

View File

@ -97,7 +97,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then
fi
cd "$BUILDDIR"
ninja
ninja "$@"
if [ "$WITH_TESTS" = 1 ] ; then
for id in 1 2 3; do
getent group $id > /dev/null || groupadd -g $id testgroup$id

View File

@ -745,4 +745,4 @@ global:
sd_event_source_set_ratelimit;
sd_event_source_get_ratelimit;
sd_event_source_is_ratelimited;
} LIBSYSTEMD_246;
} LIBSYSTEMD_247;

View File

@ -135,3 +135,8 @@ the Github CI status.
To add new dependencies or new binaries to the packages used during the tests,
a merge request can be sent to: https://salsa.debian.org/systemd-team/systemd
targeting the 'upstream-ci' branch.
The cloud-side infrastructure, that is hooked into the Github interface, is
located at:
https://git.launchpad.net/autopkgtest-cloud/

View File

@ -7,19 +7,10 @@ TEST_REQUIRE_INSTALL_TESTS=0
. $TEST_BASE_DIR/test-functions
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
setup_basic_environment
mask_supporting_services
# install tests manually so the test is functional even when -Dinstall-tests=false
mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/
cp -v $(dirname $0)/../units/{testsuite-01,end}.service $initdir/usr/lib/systemd/tests/testdata/units/
)
test_append_files() {
# install tests manually so the test is functional even when -Dinstall-tests=false
mkdir -p $1/usr/lib/systemd/tests/testdata/units/
cp -v $(dirname $0)/../units/{testsuite-01,end}.service $1/usr/lib/systemd/tests/testdata/units/
}
do_test "$@" 01

View File

@ -16,34 +16,27 @@ test -f /usr/share/selinux/devel/include/system/systemd.if || exit 0
SETUP_SELINUX=yes
KERNEL_APPEND="$KERNEL_APPEND selinux=1 security=selinux"
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
test_append_files() {
(
LOG_LEVEL=5
setup_basic_environment
mask_supporting_services
setup_selinux
local _modules_dir=/var/lib/selinux
rm -rf $initdir/$_modules_dir
if ! cp -ar $_modules_dir $initdir/$_modules_dir; then
rm -rf $1/$_modules_dir
if ! cp -ar $_modules_dir $1/$_modules_dir; then
dfatal "Failed to copy $_modules_dir"
exit 1
fi
local _policy_headers_dir=/usr/share/selinux/devel
rm -rf $initdir/$_policy_headers_dir
rm -rf $1/$_policy_headers_dir
inst_dir /usr/share/selinux
if ! cp -ar $_policy_headers_dir $initdir/$_policy_headers_dir; then
if ! cp -ar $_policy_headers_dir $1/$_policy_headers_dir; then
dfatal "Failed to copy $_policy_headers_dir"
exit 1
fi
mkdir $initdir/systemd-test-module
cp systemd_test.te $initdir/systemd-test-module
cp systemd_test.if $initdir/systemd-test-module
mkdir $1/systemd-test-module
cp systemd_test.te $1/systemd-test-module
cp systemd_test.if $1/systemd-test-module
dracut_install -o sesearch
dracut_install runcon
dracut_install checkmodule semodule semodule_package m4 make load_policy sefcontext_compile

View File

@ -7,16 +7,6 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
FSTYPE=ext4
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
setup_basic_environment
)
mask_supporting_services
}
TEST_FORCE_NEWIMAGE=1
do_test "$@" 08

View File

@ -6,17 +6,10 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
test_append_files() {
(
LOG_LEVEL=5
setup_basic_environment
mask_supporting_services
../create-busybox-container $initdir/testsuite-13.nc-container
initdir="$initdir/testsuite-13.nc-container" dracut_install nc ip md5sum
../create-busybox-container $1/testsuite-13.nc-container
initdir="$1/testsuite-13.nc-container" dracut_install nc ip md5sum
)
}

View File

@ -6,16 +6,8 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
(
LOG_LEVEL=5
setup_basic_environment
mask_supporting_services
printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >$initdir/etc/machine-id
)
test_append_files() {
printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >$1/etc/machine-id
}
do_test "$@" 14

View File

@ -3,6 +3,7 @@ set -e
TEST_DESCRIPTION="cryptsetup systemd setup"
IMAGE_NAME="cryptsetup"
TEST_NO_NSPAWN=1
TEST_FORCE_NEWIMAGE=1
. $TEST_BASE_DIR/test-functions

View File

@ -7,15 +7,8 @@ TEST_NO_NSPAWN=1
. $TEST_BASE_DIR/test-functions
QEMU_TIMEOUT=300
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
test_append_files() {
(
LOG_LEVEL=5
setup_basic_environment
mask_supporting_services
instmods dummy
generate_module_dependencies
)

View File

@ -13,16 +13,8 @@ command -v veritysetup >/dev/null 2>&1 || exit 0
command -v sfdisk >/dev/null 2>&1 || exit 0
# Need loop devices for systemd-dissect
test_create_image() {
create_empty_image_rootdir
# Create what will eventually be our root filesystem onto an overlay
# If some pieces are missing from the host, skip rather than fail
test_append_files() {
(
LOG_LEVEL=5
setup_basic_environment
mask_supporting_services
instmods loop =block
instmods squashfs =squashfs
instmods dm_verity =md

View File

@ -17,6 +17,11 @@ TIMED_OUT= # will be 1 after run_* if *_TIMEOUT is set and test timed out
UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}"
EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}"
QEMU_MEM="${QEMU_MEM:-512M}"
# Note that defining a different IMAGE_NAME in a test setup script will only result
# in default.img being copied and renamed. It can then be extended by defining
# a test_append_files() function. The $1 parameter will be the root directory.
# To force creating a new image from scratch (eg: to encrypt it), also define
# TEST_FORCE_NEWIMAGE=1 in the test setup script.
IMAGE_NAME=${IMAGE_NAME:-default}
TEST_REQUIRE_INSTALL_TESTS="${TEST_REQUIRE_INSTALL_TESTS:-1}"
TEST_PARALLELIZE="${TEST_PARALLELIZE:-0}"
@ -2065,24 +2070,43 @@ test_setup() {
mount_initdir
else
if [ ! -e "$IMAGE_PUBLIC" ]; then
# Create the backing public image, but then completely unmount
# it and drop the loopback device responsible for it, since we're
# going to symlink/copy the image and mount it again from
# elsewhere.
test_create_image
test_setup_cleanup
umount_loopback
cleanup_loopdev
# default.img is the base that every test uses and optionally appends to
if [ ! -e "${IMAGESTATEDIR}/default.img" ] || [ -n "${TEST_FORCE_NEWIMAGE}" ]; then
# Create the backing public image, but then completely unmount
# it and drop the loopback device responsible for it, since we're
# going to symlink/copy the image and mount it again from
# elsewhere.
local image_old=${IMAGE_PUBLIC}
if [ -z "${TEST_FORCE_NEWIMAGE}" ]; then
IMAGE_PUBLIC="${IMAGESTATEDIR}/default.img"
fi
test_create_image
test_setup_cleanup
umount_loopback
cleanup_loopdev
IMAGE_PUBLIC="${image_old}"
fi
if [ "${IMAGE_NAME}" != "default" ] && [ -z "${TEST_FORCE_NEWIMAGE}" ]; then
cp -v "$(realpath "${IMAGESTATEDIR}/default.img")" "$IMAGE_PUBLIC"
fi
fi
local hook_defined=1
if declare -f -F test_append_files > /dev/null; then
hook_defined=$?
fi
echo "Reusing existing cached image $IMAGE_PUBLIC → $(realpath $IMAGE_PUBLIC)"
if [ ${TEST_PARALLELIZE} -ne 0 ]; then
if [ ${TEST_PARALLELIZE} -ne 0 ] || [ ${hook_defined} -eq 0 ]; then
cp -v "$(realpath $IMAGE_PUBLIC)" "$IMAGE_PRIVATE"
else
ln -sv "$(realpath $IMAGE_PUBLIC)" "$IMAGE_PRIVATE"
fi
mount_initdir
if [ ${hook_defined} -eq 0 ]; then
test_append_files "$initdir"
fi
fi
setup_nspawn_root