Skip to content

Commit 28f2bca

Browse files
linesightclaude
andcommitted
Fix Linux CI test failures and improve cache hit speed
- automate.py: skip create_prebuilt_binaries() if output dir already exists so CI cache hits avoid re-copying hundreds of MB each run - cef_linux.pxd: expose cef_runtime_style_t enum and CefWindowInfo runtime_style field in Cython declaration - window_info.pyx: set CEF_RUNTIME_STYLE_ALLOY for Linux windowed browsers (CEF 123+ requirement, already done for Windows/popup) - cefpython.pyx: extend Initialize() pump loop timeout from 2s to 6s so OnContextInitialized has time to fire on slow Ubuntu 24.04 CI - main_test.py: add --disable-gpu/--disable-gpu-compositing for Linux, reducing startup time and GPU process failures under xvfb Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 596b998 commit 28f2bca

5 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/cefpython.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,15 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
625625
# 200 * 10ms = 2 seconds max; OnContextInitialized typically fires
626626
# within the first few iterations.
627627
if ret:
628-
for _ in range(200):
628+
for _ in range(600):
629629
with nogil:
630630
CefDoMessageLoopWork()
631631
if g_context_initialized:
632632
break
633633
time.sleep(0.01)
634634
if not g_context_initialized:
635635
Debug("CefInitialize() WARNING: OnContextInitialized not received"
636-
" within 2 seconds")
636+
" within 6 seconds")
637637

638638
if sys.platform.startswith("linux"):
639639
# Install by default.

src/extern/cef/cef_linux.pxd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ cdef extern from "include/internal/cef_linux.h":
1212
ctypedef unsigned long CefWindowHandle
1313
ctypedef unsigned long CefCursorHandle
1414

15+
ctypedef enum cef_runtime_style_t:
16+
CEF_RUNTIME_STYLE_DEFAULT
17+
CEF_RUNTIME_STYLE_CHROME
18+
CEF_RUNTIME_STYLE_ALLOY
19+
1520
cdef cppclass CefWindowInfo:
21+
cef_runtime_style_t runtime_style
1622
void SetAsChild(CefWindowHandle parent,
1723
const CefRect& windowRect)
1824
void SetAsWindowless(CefWindowHandle parent)

src/window_info.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ cdef void SetCefWindowInfo(
5858
cefWindowInfo.SetAsChild(
5959
<CefWindowHandle>windowInfo.parentWindowHandle,
6060
windowRect)
61+
# CEF 123+: must request Alloy runtime for native windowed rendering.
62+
cefWindowInfo.runtime_style = CEF_RUNTIME_STYLE_ALLOY
6163

6264
# POPUP WINDOW - Windows only
6365
IF UNAME_SYSNAME == "Windows":

tools/automate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,9 @@ def create_prebuilt_binaries():
678678
version_header = os.path.join(src, "include", "cef_version.h")
679679
dst = get_prebuilt_name(version_header)
680680
dst = os.path.join(Options.build_dir, dst)
681-
rmdir(dst)
681+
if os.path.exists(dst):
682+
print("[automate.py] Already exists: %s" % dst)
683+
return
682684
os.makedirs(dst)
683685
bindir = os.path.join(dst, "bin")
684686
libdir = os.path.join(dst, "lib")

unittests/main_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ def test_main(self):
150150
# /dev/shm is too small in CI containers; renderer subprocess
151151
# fails shared-memory descriptor lookup (global descriptor 7).
152152
switches["disable-dev-shm-usage"] = ""
153+
# GPU acceleration is not available under xvfb; disabling it
154+
# reduces startup time and avoids GPU process launch failures.
155+
switches["disable-gpu"] = ""
156+
switches["disable-gpu-compositing"] = ""
153157
cef.Initialize(settings, switches=switches)
154158
subtest_message("cef.Initialize() ok")
155159

0 commit comments

Comments
 (0)