mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 00:02:10 +00:00
test(linux): preserve AppImage startup failure logs
This commit is contained in:
@@ -86,9 +86,9 @@ process_is_xvfb() {
|
||||
|
||||
signal_process_group() {
|
||||
local signal=$1
|
||||
identity_alive "$launcher_pid" "$launcher_start_ticks" || return
|
||||
[[ "$launcher_pgid" =~ ^[0-9]+$ ]] || return
|
||||
[[ "$launcher_pgid" != "$(ps -o pgid= -p "$$" | tr -d ' ')" ]] || return
|
||||
identity_alive "$launcher_pid" "$launcher_start_ticks" || return 0
|
||||
[[ "$launcher_pgid" =~ ^[0-9]+$ ]] || return 0
|
||||
[[ "$launcher_pgid" != "$(ps -o pgid= -p "$$" | tr -d ' ')" ]] || return 0
|
||||
kill -s "$signal" -- "-$launcher_pgid" 2>/dev/null || true
|
||||
}
|
||||
|
||||
@@ -135,11 +135,11 @@ dump_logs() {
|
||||
cleanup() {
|
||||
local status=$?
|
||||
trap - EXIT
|
||||
signal_process_group TERM
|
||||
signal_owned_processes TERM
|
||||
signal_process_group TERM || true
|
||||
signal_owned_processes TERM || true
|
||||
if ! wait_for_owned_exit 10; then
|
||||
signal_process_group KILL
|
||||
signal_owned_processes KILL
|
||||
signal_process_group KILL || true
|
||||
signal_owned_processes KILL || true
|
||||
wait_for_owned_exit 5 || status=1
|
||||
fi
|
||||
wait "$launcher_pid" 2>/dev/null || true
|
||||
|
||||
@@ -11,6 +11,10 @@ const shutdownDockerRunner = readFileSync(
|
||||
'utf8'
|
||||
)
|
||||
const shutdownDockerfile = readFileSync('config/docker/headless-serve-shutdown/Dockerfile', 'utf8')
|
||||
const desktopStartupOracle = readFileSync(
|
||||
'config/docker/headless-serve-shutdown/run-appimage-desktop-startup-case.sh',
|
||||
'utf8'
|
||||
)
|
||||
|
||||
function readSystemdUnitBlocks(doc, unitName) {
|
||||
const escapedUnitName = unitName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
@@ -122,6 +126,11 @@ describe('headless serve shutdown PR gate', () => {
|
||||
expect(shutdownDockerRunner).toContain("'/usr/local/bin/run-appimage-desktop-startup-case'")
|
||||
})
|
||||
|
||||
it('preserves startup logs when the launcher exits before its marker', () => {
|
||||
expect(desktopStartupOracle).toContain('signal_process_group TERM || true')
|
||||
expect(desktopStartupOracle).toContain('signal_process_group KILL || true')
|
||||
})
|
||||
|
||||
it('keeps owned Xvfb alive during the documented systemd graceful stop', () => {
|
||||
const serveUnits = readSystemdUnitBlocks(headlessLinuxGuide, 'orca-serve.service')
|
||||
const ownedXvfbUnits = serveUnits.filter((unit) => !/^Environment=DISPLAY=/m.test(unit))
|
||||
|
||||
Reference in New Issue
Block a user