Don't reuse --unit values across (sequential, even) systemd-run invocations

At least some old versions of systemd-run apparently have occasional issues when
sequential invocations reuse the same --unit value, as
<https://ci.libreoffice.org/job/lo_ubsan/2982/> now (i.e., after the machine was
updated to auto-detect --with-coredumpctl) failed with

> [build CUT] basctl_dialogs_test
> LO_TEST_LOCALE=de
> Running scope as unit: -home-tdf-lode-jenkins-workspace-lo_ubsan-workdir-CppunitTest-basctl_dialogs_test.test:20231117013657:704127.scope
[...]
> LO_TEST_LOCALE=en-US
> Running scope as unit: -home-tdf-lode-jenkins-workspace-lo_ubsan-workdir-CppunitTest-basctl_dialogs_test.test:20231117013657:704127.scope
[...]
> LO_TEST_LOCALE=fi
> Failed to start transient scope unit: Unit -home-tdf-lode-jenkins-workspace-lo_ubsan-workdir-CppunitTest-basctl_dialogs_test.test:20231117013657:704127.scope already exists.

Change-Id: If009e26231228bec739637e4140be90c0b86d6b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159569
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2023-11-17 14:23:41 +01:00
parent 1750078e3a
commit 533e993f2d

View file

@ -27,7 +27,7 @@ gb_CppunitTest_coredumpctl_setup :=
gb_CppunitTest_coredumpctl_run :=
else
gb_CppunitTest_coredumpctl_setup = \
export LIBO_TEST_UNIT=$$($(SYSTEMD_ESCAPE) "$1:$$(date -u +%Y%m%d%H%M%S):$$$$" | cut -b -249) &&
export LIBO_TEST_UNIT=$$($(SYSTEMD_ESCAPE) "$1:$$(date -u +%Y%m%d%H%M%S):$$$$$(if $2,:$2)" | cut -b -249) &&
gb_CppunitTest_coredumpctl_run := $(SYSTEMD_RUN) --scope --user --unit="$$LIBO_TEST_UNIT"
endif
@ -135,10 +135,11 @@ else
$(if $(gb_CppunitTest__interactive),, \
$(if $(value gb_CppunitTest_postprocess), \
rm -fr $@.core && mkdir $@.core && cd $@.core &&)) \
$(call gb_CppunitTest_coredumpctl_setup,$@) \
( \
$(if $(gb_CppunitTest_localized),for l in $(WITH_LANG_LIST) ; do \
printf 'LO_TEST_LOCALE=%s\n' "$$l" && LO_TEST_LOCALE="$$l" ) \
printf 'LO_TEST_LOCALE=%s\n' "$$l" && ) \
$(call gb_CppunitTest_coredumpctl_setup,$@,$(if $(gb_CppunitTest_localized),$$l)) \
$(if $(gb_CppunitTest_localized),LO_TEST_LOCALE="$$l") \
$(if $(gb_CppunitTest__vcl_no_svp), \
$(filter-out SAL_USE_VCLPLUGIN=svp,$(gb_TEST_ENV_VARS)),$(gb_TEST_ENV_VARS)) \
$(EXTRA_ENV_VARS) \