modifying integration_test.rb to work with other dependencies

This commit is contained in:
thibhero 2025-03-05 21:29:02 -05:00
parent 665fbc382d
commit 0b9374b7ac

View File

@ -135,13 +135,43 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
case name case name
when /^testball/ when /^testball/
# Use a different tarball for testball2 to avoid lock errors when writing concurrency tests # Use a different tarball for testball2 to avoid lock errors when writing concurrency tests
prefix = (name == "testball2") ? "testball2" : "testball" if name == "testball3" || name == "testball4"
tarball = if OS.linux? tarball = if OS.linux?
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1-linux.tbz" TEST_FIXTURE_DIR/"tarballs/#{name}-0.1-linux.tbz"
else
TEST_FIXTURE_DIR/"tarballs/#{name}-0.1.tbz"
end
content = <<~RUBY
desc "Some test"
homepage "https://brew.sh/#{name}"
url "file://#{tarball}"
sha256 "#{tarball.sha256}"
option "with-foo", "Build with foo"
#{bottle_block}
def install
STDERR.puts prefix
(prefix/"foo"/"#{name}").write("#{name}") if build.with? "foo"
prefix.install Dir["*"]
(buildpath/"#{name}.c").write \
"#include <stdio.h>\\nint main(){printf(\\"#{name}\\");return 0;}"
bin.mkpath
system ENV.cc, "#{name}.c", "-o", bin/"#{name}"
end
#{content}
# something here
RUBY
else else
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1.tbz" prefix = (name == "testball2") ? "testball2" : "testball"
end tarball = if OS.linux?
content = <<~RUBY TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1-linux.tbz"
else
TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1.tbz"
end
content = <<~RUBY
desc "Some test" desc "Some test"
homepage "https://brew.sh/#{name}" homepage "https://brew.sh/#{name}"
url "file://#{tarball}" url "file://#{tarball}"
@ -161,7 +191,8 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
#{content} #{content}
# something here # something here
RUBY RUBY
end
when "bar" when "bar"
content = <<~RUBY content = <<~RUBY
url "https://brew.sh/#{name}-1.0" url "https://brew.sh/#{name}-1.0"