Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inlyne: update test to remove expect dependency #202603

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions Formula/i/inlyne.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,63 @@
depends_on "pkgconf" => :build
depends_on "rust" => :build

uses_from_macos "expect" => :test

on_linux do
depends_on "xorg-server" => :test
depends_on "fontconfig" # for fontsdb
depends_on "libxcursor" # for winit on X11
depends_on "libxkbcommon"
depends_on "wayland"
end

def install
system "cargo", "install", *std_cargo_args
bin.env_script_all_files libexec/"bin", FONTCONFIG_FILE: etc/"fonts/fonts.conf" if OS.linux?

bash_completion.install "completions/inlyne.bash" => "inlyne"
fish_completion.install "completions/inlyne.fish"
zsh_completion.install "completions/_inlyne"
end

test do

Check failure on line 39 in Formula/i/inlyne.rb

View workflow job for this annotation

GitHub Actions / Linux

`brew test --verbose inlyne` failed on Linux!

2025-01-17T16:46:39.416822Z INFO wgpu_hal::gles::egl: Loading Wayland library to get the current display 2025-01-17T16:46:39.416886Z INFO wgpu_hal::gles::egl: Loading X11 library to get the current display 2025-01-17T16:46:39.417458Z INFO wgpu_hal::gles::egl: Using X11 platform libEGL warning: DRI3: Screen seems not DRI3 capable libEGL warning: DRI3: Screen seems not DRI3 capable MESA: error: ZINK: failed to load libvulkan.so.1 libEGL warning: egl: failed to create dri2 screen 2025-01-17T16:46:39.422624Z INFO wgpu_hal::gles::egl: Display vendor "Mesa Project", version (1, 5) 2025-01-17T16:46:39.422637Z INFO wgpu_hal::gles::egl: EGL surface: +srgb 2025-01-17T16:46:39.422654Z INFO wgpu_hal::gles::egl: Trying native-render 2025-01-17T16:46:39.422671Z INFO wgpu_hal::gles::egl: EGL context: +robust access EXT 2025-01-17T16:46:39.455760Z INFO wgpu_hal::gles::egl: EGL context: +surfaceless 2025-01-17T16:46:39.456068Z INFO wgpu_hal::gles::adapter: Vendor: Mesa 2025-01-17T16:46:39.456072Z INFO wgpu_hal::gles::adapter: Renderer: llvmpipe (LLVM 19.1.4, 256 bits) 2025-01-17T16:46:39.456074Z INFO wgpu_hal::gles::adapter: Version: OpenGL ES 3.2 Mesa 24.2.8 2025-01-17T16:46:39.456081Z INFO wgpu_hal::gles::adapter: SL version: OpenGL ES GLSL ES 3.20 2025-01-17T16:46:39.456107Z INFO wgpu_core::instance: Adapter Gl AdapterInfo { name: "llvmpipe (LLVM 19.1.4, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "", driver_info: "", backend: Gl } 2025-01-17T16:46:39.465199Z INFO wgpu_hal::gles::device: Compiled shader NativeShader(5) 2025-01-17T16:46:39.465523Z INFO wgpu_hal::gles::device: Compiled shader NativeShader(6) 2025-01-17T16:46:39.467751Z INFO wgpu_hal::gles::device: Linked program NativeProgram(4) 2025-01-17T16:46:39.467765Z INFO wgpu_core::device: Created render pipeline Valid((0, 1, Gl)) with RenderPipelineDescriptor { label: None, layout: Some((0, 1, Gl)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (0, 1, Gl), entry_point: "vs_main" }, buffers: [VertexBufferLayout { array_stride: 28, step_mode: Vertex, attributes: [VertexAttribute { format: Float32x3, offset: 0, shader_location: 0 }, VertexAttribute { format: Float32x3, offset: 12, shader_location: 1 }] }] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative: false }, depth_stencil: None, multisample: MultisampleState { count: 1, mask: 18446744073709551615, alpha_to_coverage_enabled: false }, fragment: Some(FragmentState { stage: ProgrammableStageDescriptor { module: (0, 1, Gl), entry_point: "fs_main" }, targets: [Some(ColorTargetState { format: Rgba8UnormSrgb, blend: None, write_mask: ColorWrites(RED | GREEN | BLUE | ALPHA) })] }), multiview: None } 2025-01-17T16:46:39.467805Z INFO wgpu_core::device: configuring surface with SurfaceConfiguration { usage: TextureUsages(RENDER_ATTACHMENT), format: Rgba8UnormSrgb, width: 800, height: 600, present_mode: Fifo, alpha_mode: Opaque, view_formats: [] } 2025-01-17T16:46:39.469370Z INFO wgpu_hal::gles::device: Compiled shader NativeShader(8) 2025-01-17T16:46:39.469667Z INFO wgpu_hal::gles::device: Compiled shader NativeShader(9) 2025-01-17T16:46:39.476711Z INFO wgpu_hal::gles::device: Linked program NativeProgram(7) 2025-01-17T16:46:39.476728Z INFO wgpu_core::device: Created render pipeline Valid((1, 1, Gl)) with RenderPipelineDescriptor { label: None, layout: Some((1, 1, Gl)), vertex: VertexState { stage: ProgrammableStageDescriptor { module: (1, 1, Gl), entry_point: "vs_main" }, buffers: [VertexBufferLayout { array_stride: 20, step_mode: Vertex, attributes: [VertexAttribute { format: Float32x3, offset: 0, shader_location: 0 }, VertexAttribute { format: Float32x2, offset: 12, shader_location: 1 }] }] }, primitive: PrimitiveState { topology: TriangleList, strip_index_format: None, front_face: Ccw, cull_mode: None, unclipped_depth: false, polygon_mode: Fill, conservative:
assert_match version.to_s, shell_output("#{bin}/inlyne --version")

# Fails in Linux CI with
# "Failed to initialize any backend! Wayland status: XdgRuntimeDirNotSet X11 status: XOpenDisplayFailed"
return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]

test_markdown = testpath/"test.md"
test_markdown.write <<~EOS
test_markdown.write <<~MARKDOWN
_lorem_ **ipsum** dolor **sit** _amet_
EOS

script = (testpath/"test.exp")
script.write <<~EOS
#!/usr/bin/env expect -f
set timeout 2

spawn #{bin}/inlyne #{test_markdown}
MARKDOWN

send -- "q\r"
ENV["INLYNE_LOG"] = "info,inlyne=debug,cosmic_text=trace"
ENV["NO_COLOR"] = "1"
ENV["TMPDIR"] = testpath

expect eof
EOS
if OS.linux?
xvfb_pid = spawn Formula["xorg-server"].bin/"Xvfb", ":1", "-nolisten", "unix"
ENV["DISPLAY"] = ":1"
ENV["LC_ALL"] = "en_US.UTF-8"
ENV["XDG_RUNTIME_DIR"] = testpath
sleep 5
end

system "expect", "-f", "test.exp"
Open3.popen2e(bin/"inlyne", test_markdown) do |_stdin, stdout_and_stderr, wait_thread|
sleep 10
if wait_thread.alive?
Process.kill "TERM", wait_thread.pid
output = stdout_and_stderr.read
assert_match "Line LTR: 'lorem ipsum dolor sit amet'", output
assert_match(/style: Italic,.*\n.*Run \[\]: 'lorem'/, output)
refute_match "ERROR", output
elsif OS.mac? && Hardware::CPU.intel? && ENV["HOMEBREW_GITHUB_ACTIONS"]
# Ignore Intel macOS CI as unable to use Metal backend
else
# Output logs and crash report to help determine failure
message = "No running `inlyne` process. Logs:\n#{stdout_and_stderr.read}"
if (report = testpath.glob("report-*.toml").first)
message += "\nCrash Report:\n#{report.read}"
end
raise message
end
end
ensure
Process.kill "TERM", xvfb_pid if xvfb_pid
end
end
Loading