Add test fixtures for ELF executables

Add test/support/fixtures/elf/
and test/support/fixtures/tarballs/testball-0.1-linux.tbz
This commit is contained in:
Bob W. Hogg 2017-03-14 22:38:43 -07:00 committed by Shaun Jackman
parent 7394208873
commit 3cd869651b
8 changed files with 25 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -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"

View File

@ -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