From 0b9374b7acfc0d30c40bac261e78fe37ed4e157e Mon Sep 17 00:00:00 2001 From: thibhero Date: Wed, 5 Mar 2025 21:29:02 -0500 Subject: [PATCH] modifying integration_test.rb to work with other dependencies --- .../spec/shared_context/integration_test.rb | 45 ++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index 8c5c1740d2..4240f77abd 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -135,13 +135,43 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin case name when /^testball/ # Use a different tarball for testball2 to avoid lock errors when writing concurrency tests - prefix = (name == "testball2") ? "testball2" : "testball" - tarball = if OS.linux? - TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1-linux.tbz" + if name == "testball3" || name == "testball4" + tarball = if OS.linux? + 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 \\nint main(){printf(\\"#{name}\\");return 0;}" + bin.mkpath + system ENV.cc, "#{name}.c", "-o", bin/"#{name}" + end + + #{content} + + # something here + RUBY else - TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1.tbz" - end - content = <<~RUBY + prefix = (name == "testball2") ? "testball2" : "testball" + tarball = if OS.linux? + TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1-linux.tbz" + else + TEST_FIXTURE_DIR/"tarballs/#{prefix}-0.1.tbz" + end + + content = <<~RUBY desc "Some test" homepage "https://brew.sh/#{name}" url "file://#{tarball}" @@ -161,7 +191,8 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin #{content} # something here - RUBY + RUBY + end when "bar" content = <<~RUBY url "https://brew.sh/#{name}-1.0"