aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorWilliam Woodruff2015-08-14 14:21:39 -0400
committerMisty De Meo2015-08-21 11:02:33 -0700
commitf108d204f7e43cfd7db5c109f961a89f79efc289 (patch)
tree28eb2c79ddf3dce362b230806c1948db538ae2e5 /Library
parent8793a68ee422a2cee7035c1d564fbd81d0c72dc4 (diff)
downloadbrew-f108d204f7e43cfd7db5c109f961a89f79efc289.tar.bz2
Add tests for pouring bottle without Xcode
add testball_bottle formula for upcoming bottle unit testing, as well as bottles directory containing test bottle (and symlinks)
Diffstat (limited to 'Library')
l---------Library/Homebrew/test/bottles/testball_bottle-0.1.mavericks.bottle.tar.gz1
l---------Library/Homebrew/test/bottles/testball_bottle-0.1.mountain_lion.bottle.tar.gz1
-rw-r--r--Library/Homebrew/test/bottles/testball_bottle-0.1.yosemite.bottle.tar.gzbin0 -> 1379 bytes
-rw-r--r--Library/Homebrew/test/test_formula_installer_bottle.rb78
-rw-r--r--Library/Homebrew/test/testball_bottle.rb17
5 files changed, 97 insertions, 0 deletions
diff --git a/Library/Homebrew/test/bottles/testball_bottle-0.1.mavericks.bottle.tar.gz b/Library/Homebrew/test/bottles/testball_bottle-0.1.mavericks.bottle.tar.gz
new file mode 120000
index 000000000..3e989830b
--- /dev/null
+++ b/Library/Homebrew/test/bottles/testball_bottle-0.1.mavericks.bottle.tar.gz
@@ -0,0 +1 @@
+testball_bottle-0.1.yosemite.bottle.tar.gz \ No newline at end of file
diff --git a/Library/Homebrew/test/bottles/testball_bottle-0.1.mountain_lion.bottle.tar.gz b/Library/Homebrew/test/bottles/testball_bottle-0.1.mountain_lion.bottle.tar.gz
new file mode 120000
index 000000000..3e989830b
--- /dev/null
+++ b/Library/Homebrew/test/bottles/testball_bottle-0.1.mountain_lion.bottle.tar.gz
@@ -0,0 +1 @@
+testball_bottle-0.1.yosemite.bottle.tar.gz \ No newline at end of file
diff --git a/Library/Homebrew/test/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz b/Library/Homebrew/test/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz
new file mode 100644
index 000000000..d88838a94
--- /dev/null
+++ b/Library/Homebrew/test/bottles/testball_bottle-0.1.yosemite.bottle.tar.gz
Binary files differ
diff --git a/Library/Homebrew/test/test_formula_installer_bottle.rb b/Library/Homebrew/test/test_formula_installer_bottle.rb
new file mode 100644
index 000000000..4d2d1676f
--- /dev/null
+++ b/Library/Homebrew/test/test_formula_installer_bottle.rb
@@ -0,0 +1,78 @@
+require "testing_env"
+require "formula"
+require "compat/formula_specialties"
+require "formula_installer"
+require "keg"
+require "testball_bottle"
+require "testball"
+
+class InstallBottleTests < Homebrew::TestCase
+ def temporary_bottle_install(formula)
+ refute_predicate formula, :installed?
+ assert_predicate formula, :bottled?
+ assert_predicate formula, :pour_bottle?
+
+ installer = FormulaInstaller.new(formula)
+
+ shutup { installer.install }
+
+ keg = Keg.new(formula.prefix)
+
+ assert_predicate formula, :installed?
+
+ begin
+ yield formula
+ ensure
+ keg.unlink
+ keg.uninstall
+ formula.clear_cache
+ Dir["#{HOMEBREW_CACHE}/testball_bottle*"].each { |f| File.delete(f) }
+ # there will be log files when sandbox is enable.
+ formula.logs.rmtree if formula.logs.directory?
+ end
+
+ refute_predicate keg, :exist?
+ refute_predicate formula, :installed?
+ end
+
+ def test_a_basic_bottle_install
+ MacOS.stubs(:has_apple_developer_tools?).returns(false)
+
+ temporary_bottle_install(TestballBottle.new) do |f|
+ # Copied directly from test_formula_installer.rb as we expect
+ # the same behavior
+
+ # Test that things made it into the Keg
+ assert_predicate f.bin, :directory?
+
+ assert_predicate f.libexec, :directory?
+
+ refute_predicate f.prefix+"main.c", :exist?
+
+ # Test that things make it into the Cellar
+ keg = Keg.new f.prefix
+ keg.link
+
+ bin = HOMEBREW_PREFIX+"bin"
+ assert_predicate bin, :directory?
+ end
+ end
+
+ def test_build_tools_error
+ MacOS.stubs(:has_apple_developer_tools?).returns(false)
+
+ # Testball doesn't have a bottle block, so use it to test this behavior
+ formula = Testball.new
+
+ refute_predicate formula, :installed?
+ refute_predicate formula, :bottled?
+
+ installer = FormulaInstaller.new(formula)
+
+ assert_raises(BuildToolsError) do
+ installer.install
+ end
+
+ refute_predicate formula, :installed?
+ end
+end
diff --git a/Library/Homebrew/test/testball_bottle.rb b/Library/Homebrew/test/testball_bottle.rb
new file mode 100644
index 000000000..27ffd972a
--- /dev/null
+++ b/Library/Homebrew/test/testball_bottle.rb
@@ -0,0 +1,17 @@
+class TestballBottle < Formula
+ def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable)
+ self.class.instance_eval do
+ stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz"
+ stable.sha256 "1dfb13ce0f6143fe675b525fc9e168adb2215c5d5965c9f57306bb993170914f"
+ stable.bottle do
+ cellar :any_skip_relocation
+ root_url "file://#{File.expand_path("..", __FILE__)}/bottles"
+ sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :yosemite
+ sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :mavericks
+ sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :mountain_lion
+ end
+ cxxstdlib_check :skip
+ end
+ super
+ end
+end