2022-07-28 01:06:46 -07:00
|
|
|
# SPDX-FileCopyrightText: 2022 James R. Barlow
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
2021-12-06 01:49:29 -08:00
|
|
|
|
2022-07-23 00:39:24 -07:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2021-12-06 13:15:45 -08:00
|
|
|
import os
|
2024-01-02 16:28:22 -08:00
|
|
|
import platform
|
2021-12-06 01:49:29 -08:00
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from ocrmypdf import ExitCode
|
|
|
|
|
|
|
|
from .conftest import run_ocrmypdf_api
|
|
|
|
|
|
|
|
|
2021-12-06 13:15:45 -08:00
|
|
|
@pytest.mark.skipif(os.name == 'nt', reason="Windows doesn't have SIGKILL")
|
2024-01-02 16:28:22 -08:00
|
|
|
@pytest.mark.skipif(
|
|
|
|
platform.python_version_tuple() >= ('3', '12'), reason="can deadlock due to fork"
|
|
|
|
)
|
2022-08-11 01:13:10 -07:00
|
|
|
def test_simulate_oom_killer(multipage, no_outpdf):
|
2021-12-06 01:49:29 -08:00
|
|
|
exitcode = run_ocrmypdf_api(
|
2022-08-11 01:13:10 -07:00
|
|
|
multipage,
|
2021-12-06 01:49:29 -08:00
|
|
|
no_outpdf,
|
|
|
|
'--force-ocr',
|
2023-10-16 00:41:25 -07:00
|
|
|
'--no-use-threads',
|
2021-12-06 01:49:29 -08:00
|
|
|
'--plugin',
|
|
|
|
'tests/plugins/tesseract_simulate_oom_killer.py',
|
|
|
|
)
|
|
|
|
assert exitcode == ExitCode.child_process_error
|