diff options
| author | Bob W. Hogg | 2017-03-14 22:38:43 -0700 |
|---|---|---|
| committer | Shaun Jackman | 2017-11-26 08:37:57 -0800 |
| commit | 3cd869651beb0114580016aba46d2eda4a094523 (patch) | |
| tree | d5a7986e3ee15325c661fe48a00657e3512b3d3d /Library/Homebrew | |
| parent | 73942088733a5539599eb7132b6fc458bd50d873 (diff) | |
| download | brew-3cd869651beb0114580016aba46d2eda4a094523.tar.bz2 | |
Add test fixtures for ELF executables
Add test/support/fixtures/elf/
and test/support/fixtures/tarballs/testball-0.1-linux.tbz
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/test/cleaner_spec.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/test/cmd/install_spec.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/spec_helper.rb | 4 | ||||
| -rwxr-xr-x | Library/Homebrew/test/support/fixtures/elf/hello | bin | 0 -> 6312 bytes | |||
| -rwxr-xr-x | Library/Homebrew/test/support/fixtures/elf/libhello.so.0 | bin | 0 -> 6312 bytes | |||
| -rw-r--r-- | Library/Homebrew/test/support/fixtures/tarballs/testball-0.1-linux.tbz | bin | 0 -> 3253 bytes | |||
| -rw-r--r-- | Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/test/support/lib/config.rb | 1 |
8 files changed, 25 insertions, 5 deletions
diff --git a/Library/Homebrew/test/cleaner_spec.rb b/Library/Homebrew/test/cleaner_spec.rb index 116f00dff..6e603da0e 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 8a9f7a0d2..f0e8a4112 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 c3652fc42..d3da25dd8 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 Binary files differnew file mode 100755 index 000000000..76b86f02d --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/elf/hello diff --git a/Library/Homebrew/test/support/fixtures/elf/libhello.so.0 b/Library/Homebrew/test/support/fixtures/elf/libhello.so.0 Binary files differnew file mode 100755 index 000000000..e85b7184f --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/elf/libhello.so.0 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 Binary files differnew file mode 100644 index 000000000..5ca2be071 --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/tarballs/testball-0.1-linux.tbz 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 da01580c2..6ee6a3345 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 3a0a76722..e54fc111f 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 |
