diff --git a/Library/Homebrew/test/cleaner_spec.rb b/Library/Homebrew/test/cleaner_spec.rb index 116f00dff2..6e603da0e8 100644 --- a/Library/Homebrew/test/cleaner_spec.rb +++ b/Library/Homebrew/test/cleaner_spec.rb @@ -12,7 +12,7 @@ describe Cleaner do end describe "#clean" do - it "cleans files" do + it "cleans files", :needs_macos do f.bin.mkpath f.lib.mkpath cp "#{TEST_FIXTURE_DIR}/mach/a.out", f.bin @@ -26,6 +26,18 @@ describe Cleaner do expect((f.lib/"i386.dylib").stat.mode).to eq(0100444) end + it "cleans files", :needs_linux do + f.bin.mkpath + f.lib.mkpath + cp "#{TEST_FIXTURE_DIR}/elf/hello", f.bin + cp Dir["#{TEST_FIXTURE_DIR}/elf/libhello.so.0"], f.lib + + subject.clean + + expect((f.bin/"hello").stat.mode).to eq(0100555) + expect((f.lib/"libhello.so.0").stat.mode).to eq(0100555) + end + it "prunes the prefix if it is empty" do subject.clean expect(f.prefix).not_to be_a_directory diff --git a/Library/Homebrew/test/cmd/install_spec.rb b/Library/Homebrew/test/cmd/install_spec.rb index 8a9f7a0d2e..f0e8a4112c 100644 --- a/Library/Homebrew/test/cmd/install_spec.rb +++ b/Library/Homebrew/test/cmd/install_spec.rb @@ -71,7 +71,7 @@ describe "brew install", :integration_test do devel do url "#{Formulary.factory("testball1").stable.url}" - sha256 "#{TESTBALL_SHA256}" + sha256 "#{Formulary.factory("testball1").stable.checksum.hexdigest}" version "3.0" end EOS diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index c3652fc42c..d3da25dd82 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -61,6 +61,10 @@ RSpec.configure do |config| skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] end + config.before(:each, :needs_linux) do + skip "Not on Linux." unless OS.linux? + end + config.before(:each, :needs_macos) do skip "Not on macOS." unless OS.mac? end diff --git a/Library/Homebrew/test/support/fixtures/elf/hello b/Library/Homebrew/test/support/fixtures/elf/hello new file mode 100755 index 0000000000..76b86f02d7 Binary files /dev/null and b/Library/Homebrew/test/support/fixtures/elf/hello differ diff --git a/Library/Homebrew/test/support/fixtures/elf/libhello.so.0 b/Library/Homebrew/test/support/fixtures/elf/libhello.so.0 new file mode 100755 index 0000000000..e85b7184f2 Binary files /dev/null and b/Library/Homebrew/test/support/fixtures/elf/libhello.so.0 differ diff --git a/Library/Homebrew/test/support/fixtures/tarballs/testball-0.1-linux.tbz b/Library/Homebrew/test/support/fixtures/tarballs/testball-0.1-linux.tbz new file mode 100644 index 0000000000..5ca2be071f Binary files /dev/null and b/Library/Homebrew/test/support/fixtures/tarballs/testball-0.1-linux.tbz differ 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 da01580c23..6ee6a33451 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 @@ -123,11 +123,16 @@ RSpec.shared_context "integration test" do def setup_test_formula(name, content = nil) case name when /^testball/ + tarball = if OS.linux? + TEST_FIXTURE_DIR/"tarballs/testball-0.1-linux.tbz" + else + TEST_FIXTURE_DIR/"tarballs/testball-0.1.tbz" + end content = <<~EOS desc "Some test" homepage "https://example.com/#{name}" - url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz" - sha256 "#{TESTBALL_SHA256}" + url "file://#{tarball}" + sha256 "#{tarball.sha256}" option "with-foo", "Build with foo" diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb index 3a0a767222..e54fc111fa 100644 --- a/Library/Homebrew/test/support/lib/config.rb +++ b/Library/Homebrew/test/support/lib/config.rb @@ -35,7 +35,6 @@ HOMEBREW_TEMP = HOMEBREW_PREFIX.parent+"temp" TEST_FIXTURE_DIR = HOMEBREW_LIBRARY_PATH.join("test", "support", "fixtures") -TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37".freeze TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9".freeze PATCH_A_SHA256 = "83404f4936d3257e65f176c4ffb5a5b8d6edd644a21c8d8dcc73e22a6d28fcfa".freeze