Skip to content

Commit

Permalink
inlyne: update test to remove expect dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Jan 17, 2025
1 parent 8c78e3a commit bdaec1c
Showing 1 changed file with 36 additions and 19 deletions.
55 changes: 36 additions & 19 deletions Formula/i/inlyne.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ class Inlyne < Formula
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"
Expand All @@ -37,27 +39,42 @@ def install
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!

::error::inlyne: failed An exception occurred within a child process: RuntimeError: No `inlyne` process. Logged output: 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-17T05:45:51.599435Z DEBUG cosmic_text::font::system::std: Locale: C 2025-01-17T05:45:51.599971Z INFO cosmic_text::font::system::std: Parsed 6 font faces in 0ms. 2025-01-17T05:45:51.605631Z DEBUG inlyne::interpreter: Received markdown for interpretation: 39 bytes 2025-01-17T05:45:51.718274Z DEBUG cosmic_text::buffer: relayout: 70ns 2025-01-17T05:45:51.718291Z DEBUG cosmic_text::buffer: shape_until 1: 1.874µs 2025-01-17T05:45:51.718305Z TRACE cosmic_text::shape: Line LTR: 'lorem ipsum dolor sit amet' 2025-01-17T05:45:51.718308Z TRACE cosmic_text::shape: Span LTR: 'lorem ipsum dolor sit amet' 2025-01-17T05:45:51.718311Z TRACE cosmic_text::shape: Word: 'lorem' 2025-01-17T05:45:51.718314Z TRACE cosmic_text::shape: Run []: '' 2025-01-17T05:45:51.718319Z DEBUG cosmic_text::font::system::std: font matches for Attrs { color_opt: Some(Color(4278190080)), family: SansSerif, stretch: Normal, style: Italic, weight: Weight(400), metadata: 0 } in 981ns 2025-01-17T05:45:51.718325Z DEBUG cosmic_text::font::fallback: failed to find family 'Noto Sans' 2025-01-17T05:45:51.718327Z DEBUG cosmic_text::font::fallback: failed to find family 'DejaVu Sans' 2025-01-17T05:45:51.718328Z DEBUG cosmic_text::font::fallback: failed to find family 'FreeSans' 2025-01-17T05:45:51.718330Z DEBUG cosmic_text::font::fallback: failed to find family 'Noto Sans Mono' 2025-01-17T05:45:51.718332Z DEBUG cosmic_text::font::fallback: failed to find family 'DejaVu Sans Mono' 2025-01-17T05:45:51.718333Z DEBUG cosmic_text::font::fallback: failed to find family 'FreeMono' 2025-01-17T05:45:51.718335Z DEBUG cosmic_text::font::fallback: failed to find family 'Noto Sans Symbols' 2025-01-17T05:45:51.718336Z DEBUG cosmic_text::font::fallback: failed to find family 'Noto Sans Symbols2' 2025-01-17T05:45:51.718337Z DEBUG cosmic_text::font::fallback: failed to find family 'Noto Color Emoji' Well, this is embarrassing. inlyne had a problem and crashed. To help us diagnose the problem you can send us a crash report. We have generated a report file at "/tmp/inlyne-test-20250117-23286-3dddi0/report-3689536d-bf9d-4674-9fe7-1a5b58391e0c.toml". Submit an issue or email with the subject of "inlyne Crash Report" and include the report as an attachment. - Homepage: https://github.com/Inlyne-Project/inlyne - Authors: trimental We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports. Thank you kindly! Crash report: "name" = "inlyne" "operating_system" = "Ubuntu 22.4.0 [64-bit]" "crate_version" = "0.4.3" "explanation" = """ Panic occurred in file '/home/linuxbrew/.cache/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/cosmic-text-0.9.0/src/shape.rs' at line 174 """ "cause" = "no default font found" "method" = "Panic" "backtrace" = """ 0: 0x5627ccda572b - <unresolved> 1: 0x5627cd9bcfe8 - <unresolved> 2: 0x5627cd9bee35 - <unresolved> 3: 0x5627cd9bf6c5 - <unresolved> 4: 0x5627cd9c0150 - <unresolved> 5: 0x5627cd9b4baa - <unresolved> 6: 0x5627cd9b4cc0 - <unresolved> 7: 0x5627cd9b1a14 - <unresolved> 8: 0x5627cd9b1b39 - <unresolved> 9: 0x5627ccf03734 - <unresolved> 10: 0x5627ccf01c3d - <unresolved> 11: 0x5627ccddc2c5 - <unresolved> 12: 0x5627ccde28a1 - <unresolved> 13: 0x5627ccec455c - <unresolved> 14: 0x5627ccdd21ae - <unresolved> 15: 0x5627ccdd451b - <unresolved> 16: 0x5627ccebf27d - <unresolved> 17: 0x5627ccde4c40 - <unresolved> 18: 0x5627cce63773 - <unresolved> 19: 0x5627ccea4e3d - <unresolved> 20: 0x5627cdeaf48d - <unresolved> 21: 0x5627ccde71f5 - <unresolved> 22: 0x7fd7654ced90 - <unresolved> 23: 0x7fd7654cee40 -
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"] = "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["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 5
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 `inlyne` process. Logged output:\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

0 comments on commit bdaec1c

Please sign in to comment.