diff options
| author | Xu Cheng | 2015-12-26 16:31:06 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-12-26 18:08:45 +0800 |
| commit | e27bddc82ae85e94a2f0016b176ea2a9c6dd824d (patch) | |
| tree | d00a1e7a2141ff5149247d7af313af3e0e85b08b /Library | |
| parent | f37f8b5c7ac97f5c370c55d3c2a447766bdc90c2 (diff) | |
| download | brew-e27bddc82ae85e94a2f0016b176ea2a9c6dd824d.tar.bz2 | |
IntegrationCommandTests: improve bottle test
Also let `cmd_output` capture `$stderr`
Closes Homebrew/homebrew#47383.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index bc60ee0bb..3242362e2 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -1,5 +1,6 @@ require "bundler" require "testing_env" +require "core_formula_repository" class IntegrationCommandTests < Homebrew::TestCase def cmd_output(*args) @@ -15,7 +16,21 @@ class IntegrationCommandTests < Homebrew::TestCase ENV["HOMEBREW_BREW_FILE"] = HOMEBREW_PREFIX/"bin/brew" ENV["HOMEBREW_INTEGRATION_TEST"] = args.join " " ENV["HOMEBREW_TEST_TMPDIR"] = TEST_TMPDIR - Utils.popen_read(RUBY_PATH, *cmd_args).chomp + read, write = IO.pipe + begin + pid = fork do + read.close + $stdout.reopen(write) + $stderr.reopen(write) + write.close + exec RUBY_PATH, *cmd_args + end + write.close + read.read.chomp + ensure + Process.wait(pid) + read.close + end end end @@ -89,17 +104,26 @@ class IntegrationCommandTests < Homebrew::TestCase def test_bottle cmd("install", "--build-bottle", testball) + assert_match "Formula not from core or any taps", + cmd_fail("bottle", "--no-revision", testball) + formula_file = CoreFormulaRepository.new.formula_dir/"testball.rb" + formula_file.write <<-EOS.undent + class Testball < Formula + url "https://example.com/testabll-0.1.tar.gz" + end + EOS HOMEBREW_CACHE.cd do - assert_match(/testball-0\.1.*\.bottle\.tar\.gz/, - cmd_output("bottle", "--no-revision", testball)) + assert_match /testball-0\.1.*\.bottle\.tar\.gz/, + cmd_output("bottle", "--no-revision", "testball") end ensure - cmd("uninstall", "--force", testball) + cmd("uninstall", "--force", "testball") cmd("cleanup", "--force", "--prune=all") + formula_file.unlink end def test_uninstall - cmd("install", "--build-bottle", testball) + cmd("install", testball) assert_match "Uninstalling testball", cmd("uninstall", "--force", testball) ensure cmd("cleanup", "--force", "--prune=all") |
