-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tizen] Fix systemd services race when running tests (#25460)
* [Tizen] Fix systemd services race when running tests On the Tizen QEMU image tests are launched by the serial-getty service after auto login to root. However, there is no explicit before/after ordering between serial-getty service and ISO image mounting service. On slow systems (e.g. CI) it might happen that the serial-getty is started before ISO image mount target. This results in tests being not launched... This commit adds explicit run ordering between serial-getty and multi-user target, which shall guarantee that tests will be launched after CHIP ISO image is mounted and all Tizen services are ready. * Do not run runner script in the interactive mode * Add libncurses5 (required by GDB) to Tizen docker image
- Loading branch information
Showing
4 changed files
with
49 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ RUN set -x \ | |
RUN set -x \ | ||
&& mkdir -p /tmp/workdir && cd /tmp/workdir \ | ||
&& SYSTEMD_SYSTEM=/usr/lib/systemd/system \ | ||
&& SYSTEMD_REQUIRES_LOCAL_FS=$SYSTEMD_SYSTEM/local-fs.target.requires \ | ||
# Download Tizen images | ||
&& wget --progress=dot:giga -r -nd --no-parent -e robots=off -A 'tizen-*.tar.gz' \ | ||
http://download.tizen.org/snapshots/TIZEN/Tizen-$TIZEN_VERSION/Tizen-$TIZEN_VERSION-Unified/latest/images/standard/tizen-headless-armv7l/ \ | ||
|
@@ -80,7 +81,7 @@ RUN set -x \ | |
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends libguestfs-tools linux-image-generic \ | ||
# Add extra libraries to the root image | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda glob copy-in \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda copy-in \ | ||
$TIZEN_SDK_TOOLCHAIN/arm-tizen-linux-gnueabi/lib/libasan.so.* \ | ||
$TIZEN_SDK_TOOLCHAIN/arm-tizen-linux-gnueabi/lib/libubsan.so.* \ | ||
$TIZEN_SDK_SYSROOT/usr/lib/libbluetooth-api.so.* \ | ||
|
@@ -89,17 +90,22 @@ RUN set -x \ | |
$TIZEN_SDK_SYSROOT/usr/lib/libnsd-dns-sd.so.* \ | ||
/usr/lib/ \ | ||
# Disable failing systemd services | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda glob rm $SYSTEMD_SYSTEM/deviced.service \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda glob rm $SYSTEMD_SYSTEM/mnt-inform.mount \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda glob rm $SYSTEMD_SYSTEM/murphyd.service \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda glob rm $SYSTEMD_SYSTEM/pulseaudio.service \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda \ | ||
glob rm $SYSTEMD_SYSTEM/clone_partitions.service : \ | ||
glob rm $SYSTEMD_SYSTEM/deviced.service : \ | ||
glob rm $SYSTEMD_SYSTEM/mm-resource-managerd.service : \ | ||
glob rm $SYSTEMD_SYSTEM/mnt-inform.mount : \ | ||
glob rm $SYSTEMD_SYSTEM/muse-server.* : \ | ||
glob rm $SYSTEMD_SYSTEM/murphyd.service : \ | ||
glob rm $SYSTEMD_SYSTEM/pulseaudio.service \ | ||
# Mount Tizen system partition on /opt-ro instead of /opt | ||
&& SYSTEMD_UNIT_OPT_RO_MOUNT=$SYSTEMD_SYSTEM/opt\\x2dro.mount \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda ln-sf $SYSTEMD_UNIT_OPT_RO_MOUNT $SYSTEMD_SYSTEM/local-fs.target.requires \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda mv $SYSTEMD_SYSTEM/opt.mount $SYSTEMD_UNIT_OPT_RO_MOUNT \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda \ | ||
mv $SYSTEMD_SYSTEM/opt.mount $SYSTEMD_UNIT_OPT_RO_MOUNT : \ | ||
ln-sf $SYSTEMD_UNIT_OPT_RO_MOUNT $SYSTEMD_REQUIRES_LOCAL_FS : \ | ||
mkdir /opt-ro \ | ||
&& virt-edit $TIZEN_IOT_IMAGE_ROOT -e 's#/opt#/opt-ro#g' $SYSTEMD_UNIT_OPT_RO_MOUNT \ | ||
&& virt-edit $TIZEN_IOT_IMAGE_ROOT -e 's#Options=#Options=ro,#' $SYSTEMD_UNIT_OPT_RO_MOUNT \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda mkdir /opt-ro \ | ||
# Create /tmp/.opt-upper and /tmp/.opt-work after /tmp is mounted | ||
&& SYSTEMD_UNIT_OPT_PRE_MOUNT=$SYSTEMD_SYSTEM/opt.pre-mount.service \ | ||
&& echo -n \ | ||
|
@@ -113,7 +119,6 @@ RUN set -x \ | |
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_OPT_PRE_MOUNT \ | ||
# Mount Tizen system partition as a tmp-based overlay | ||
&& SYSTEMD_UNIT_OPT_MOUNT=$SYSTEMD_SYSTEM/opt.mount \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda ln-sf $SYSTEMD_UNIT_OPT_MOUNT $SYSTEMD_SYSTEM/local-fs.target.requires \ | ||
&& echo -n \ | ||
"[Unit]\nConditionPathIsMountPoint=!/opt\n" \ | ||
"RequiresMountsFor=/opt-ro /tmp\n" \ | ||
|
@@ -124,10 +129,10 @@ RUN set -x \ | |
"Where=/opt\n" \ | ||
"Type=overlay\n" \ | ||
"Options=lowerdir=/opt-ro,upperdir=/tmp/.opt-upper,workdir=/tmp/.opt-work\n" \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_OPT_MOUNT \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_OPT_MOUNT : \ | ||
ln-sf $SYSTEMD_UNIT_OPT_MOUNT $SYSTEMD_REQUIRES_LOCAL_FS \ | ||
# Fix SMACK label for /tmp/.opt-work/work | ||
&& SYSTEMD_UNIT_OPT_POST_MOUNT=$SYSTEMD_SYSTEM/opt.post-mount.service \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda ln-sf $SYSTEMD_UNIT_OPT_POST_MOUNT $SYSTEMD_SYSTEM/local-fs.target.requires \ | ||
&& echo -n \ | ||
"[Unit]\n" \ | ||
"DefaultDependencies=no\n" \ | ||
|
@@ -136,30 +141,37 @@ RUN set -x \ | |
"Type=oneshot\n" \ | ||
"ExecStart=chsmack -a * /tmp/.opt-work/work\n" \ | ||
"RemainAfterExit=yes\n" \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_OPT_POST_MOUNT \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_OPT_POST_MOUNT : \ | ||
ln-sf $SYSTEMD_UNIT_OPT_POST_MOUNT $SYSTEMD_REQUIRES_LOCAL_FS \ | ||
# Mount Matter ISO image on startup | ||
&& SYSTEMD_UNIT_CHIP_MOUNT=$SYSTEMD_SYSTEM/mnt-chip.mount \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda ln-sf $SYSTEMD_UNIT_CHIP_MOUNT $SYSTEMD_SYSTEM/local-fs.target.requires \ | ||
&& echo -n \ | ||
"[Unit]\n" \ | ||
"ConditionPathIsMountPoint=!/mnt/chip\n" \ | ||
"[Mount]\n" \ | ||
"What=/dev/disk/by-label/CHIP\n" \ | ||
"Where=/mnt/chip\n" \ | ||
"Options=nofail\n" \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_CHIP_MOUNT \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda mkdir /mnt/chip \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - $SYSTEMD_UNIT_CHIP_MOUNT : \ | ||
ln-sf $SYSTEMD_UNIT_CHIP_MOUNT $SYSTEMD_REQUIRES_LOCAL_FS : \ | ||
mkdir /mnt/chip \ | ||
# Setup auto-login for root user | ||
&& SYSTEMD_UNIT_SERIAL_GETTY=$SYSTEMD_SYSTEM/[email protected] \ | ||
&& virt-edit $TIZEN_IOT_IMAGE_ROOT -e \ | ||
's#^ExecStart=.*#ExecStart=-/sbin/agetty -o "-p -f root" --noclear -a root --keep-baud 115200 %I \$TERM#' $SYSTEMD_UNIT_SERIAL_GETTY \ | ||
# Run serial-getty.service after multi-user.target | ||
&& SYSTEMD_WANTS_GRAPHICAL=$SYSTEMD_SYSTEM/graphical.target.wants \ | ||
&& SYSTEMD_WANTS_MULTI_USER=$SYSTEMD_SYSTEM/multi-user.target.wants \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda mv $SYSTEMD_WANTS_MULTI_USER/getty.target $SYSTEMD_WANTS_GRAPHICAL \ | ||
&& virt-edit $TIZEN_IOT_IMAGE_ROOT -e 's#^After=#Before=serial-getty\@ttyAMA0.service\nAfter=#' $SYSTEMD_SYSTEM/multi-user.target \ | ||
# Execute launcher script after root login | ||
&& echo -n \ | ||
"[ -x /launcher.sh ] && /launcher.sh\n" \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - /root/.profile \ | ||
# Launcher script | ||
&& echo -n \ | ||
"#!/bin/bash\n" \ | ||
"grep -q 'rootshell' /proc/cmdline && exit\n" \ | ||
"if [[ -x /mnt/chip/runner.sh ]]; then\n" \ | ||
" echo '### RUNNER START ###'\n" \ | ||
" /mnt/chip/runner.sh\n" \ | ||
|
@@ -169,8 +181,7 @@ RUN set -x \ | |
"fi\n" \ | ||
"echo 'Shutting down emulated system...'\n" \ | ||
"echo o > /proc/sysrq-trigger\n" \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - /launcher.sh \ | ||
&& guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda chmod 0755 /launcher.sh \ | ||
| guestfish --rw -a $TIZEN_IOT_IMAGE_ROOT -m /dev/sda upload - /launcher.sh : chmod 0755 /launcher.sh \ | ||
# Remove ALL previously installed packages | ||
&& apt-get autopurge -fy $(tail -2 /var/log/apt/history.log | grep ^Install | cut -c 10- | sed 's/([^)]*),\?//g') \ | ||
&& rm -rf /var/lib/apt/lists \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.6.48 Version bump reason: [android] Correct kotlinc path for vscode image | ||
0.6.49 Version bump reason: Fix systemd services run race in Tizen QEMU image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters