summaryrefslogtreecommitdiff
path: root/loolwsd-systemplate-setup
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-07-02 17:54:28 -0400
committerAshod Nakashian <ashnakash@gmail.com>2020-07-07 19:05:23 +0200
commitd6259d6a54e0e7873b2f4eb844c75bf0003245c6 (patch)
treedc1ebd4ff4770bf63417bac969c67a9d576e0845 /loolwsd-systemplate-setup
parente5188272c768e3cb4da8f87f93fd06a510d2f930 (diff)
wsd: support parallel systemplate setup
When tests are run in parallel, they will all compete to update and set up the systemplate directory, which has a handful of files that need to be up-to-date. This is a source of errors. Normally, these files are linked (hard- or soft- link, whichever succeeds). With linking, we only need to worry about the initial setup, as the files will never be out-of-date from then on. However, when linking fails, we need to copy the files, and update them (by copying over fresh versions of the files, if necessary) every time a new kit is forked. Copying over is tricky, as it's not atomic. To make it atomic, we copy the files to the destination directory under a temporary (random) name, and then rename to the final name (which is atomic, including replacing the target file, if it exists). No such race exists in production, where there is (or should be) but one instance of loolwsd (which does the initial setup) and forkit (which updates systemplate before forking new kit instances). This is an issue with parallel tests only. Change-Id: I6ba1514d00a84da7397d28efeb6378619711d52f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97785 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'loolwsd-systemplate-setup')
-rwxr-xr-xloolwsd-systemplate-setup12
1 files changed, 4 insertions, 8 deletions
diff --git a/loolwsd-systemplate-setup b/loolwsd-systemplate-setup
index 5b7bda6e8..2f6e462e0 100755
--- a/loolwsd-systemplate-setup
+++ b/loolwsd-systemplate-setup
@@ -21,16 +21,12 @@ cd / || exit 1
# into the template tree of system files for the chroot jails.
# First essential files and shared objects
-find etc/hosts etc/nsswitch.conf etc/resolv.conf \
- etc/passwd etc/group etc/host.conf \
- etc/ld.so.* \
+find etc/ld.so.* \
lib/ld-* lib64/ld-* \
lib/libnss_* lib64/libnss_* lib/*/libnss_* \
lib/libresolv* lib64/libresolv* lib/*/libresolv* \
var/cache/fontconfig \
etc/fonts \
- etc/timezone \
- etc/localtime \
usr/lib/locale/en_US.utf8 \
usr/lib/locale/C.UTF-8 \
usr/lib/locale/locale_archive \
@@ -42,9 +38,6 @@ find etc/hosts etc/nsswitch.conf etc/resolv.conf \
-type f 2>/dev/null
find etc/fonts \
- etc/timezone \
- etc/localtime \
- etc/resolv.conf \
lib/ld-* lib64/ld-* \
lib/libnss_* lib64/libnss_* lib/*/libnss_* \
lib/libresolv* lib64/libresolv* lib/*/libresolv* \
@@ -65,6 +58,9 @@ grep -v dynamic | cut -d " " -f 3 | grep -E '^(/lib|/usr)' | sort -u | sed -e 's
# This will now copy the file a symlink points to, but whatever.
cpio -p -d -L $CHROOT
+# Remove the dynamic files, which are linked by loolwsd.
+rm -f $CHROOT/etc/{hosts,nsswitch.conf,resolv.conf,passwd,group,host.conf,timezone,localtime}
+
mkdir -p $CHROOT/lo
mkdir -p $CHROOT/dev
mkdir -p $CHROOT/tmp/dev