1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

CI: Ensure the manpage generation step shuts down the VM on failure

Currently, if the script fails, it simply runs "exit 1". This exits the
script, but keeps the VM running, so CI hangs until it times out.

Instead of exiting, write a failure status to an error log and shutdown.
CI can then read that error log and fail the run if needed.
This commit is contained in:
Timothy Flynn 2022-10-31 12:26:17 -04:00 committed by Linus Groh
parent 5ebfa8d620
commit 9e9a07415e
2 changed files with 28 additions and 4 deletions

View file

@ -5,7 +5,20 @@ export ARGSPARSER_EMIT_MARKDOWN=1
# Qemu likes to start us in the middle of a line, so: # Qemu likes to start us in the middle of a line, so:
echo echo
rm -rf generated_manpages || exit 1 ERROR_FILE="generate_manpages_error.log"
rm -f "$ERROR_FILE"
exit_for_error()
{
if test $DO_SHUTDOWN_AFTER_GENERATE {
touch "$ERROR_FILE" # Ensure it exists, in case there wasn't any stderr output.
shutdown -n
} else {
exit 1
}
}
rm -rf generated_manpages 2> "$ERROR_FILE" || exit_for_error
for i in ( \ for i in ( \
(UserspaceEmulator 1) \ (UserspaceEmulator 1) \
@ -36,8 +49,8 @@ for i in ( \
filename="generated_manpages/man$i[1]/$i[0].md" filename="generated_manpages/man$i[1]/$i[0].md"
mkdir -p "generated_manpages/man$i[1]" mkdir -p "generated_manpages/man$i[1]"
echo "Generating for $i[0] in $filename ..." echo "Generating for $i[0] in $filename ..."
$i[0] --help > "$filename" || exit 1 $i[0] --help > "$filename" 2> "$ERROR_FILE" || exit_for_error
echo -e "\n<!-- Auto-generated through ArgsParser -->" >> "$filename" || exit 1 echo -e "\n<!-- Auto-generated through ArgsParser -->" >> "$filename" 2> "$ERROR_FILE" || exit_for_error
} }
echo "Successful." echo "Successful."

View file

@ -54,9 +54,20 @@ export SERENITY_KERNEL_CMDLINE="graphics_subsystem_mode=off panic=shutdown syste
ninja -C "$BUILD_DIR" -- run | sed -re 's,''c,,' ninja -C "$BUILD_DIR" -- run | sed -re 's,''c,,'
echo echo
echo "Extracting generated manpages ..."
mkdir fsmount mkdir fsmount
sudo mount -t ext2 -o loop,rw "$BUILD_DIR"/_disk_image fsmount sudo mount -t ext2 -o loop,rw "$BUILD_DIR"/_disk_image fsmount
if sudo test -f "fsmount/root/generate_manpages_error.log"; then
echo ":^( Generating manpages failed, error log:"
sudo cat fsmount/root/generate_manpages_error.log
sudo umount fsmount
rmdir fsmount
exit 1
fi
echo "Extracting generated manpages ..."
# 'cp' would create the new files as root, but we don't want that. # 'cp' would create the new files as root, but we don't want that.
sudo tar -C fsmount/root/generated_manpages --create . | tar -C Base/usr/share/man/ --extract sudo tar -C fsmount/root/generated_manpages --create . | tar -C Base/usr/share/man/ --extract
sudo umount fsmount sudo umount fsmount