mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
tests: test on Ubuntu 18.04.
This commit is contained in:
parent
d3852122ab
commit
59f4b5226a
@ -1,23 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# dump information variables for debugging
|
|
||||||
echo "==> env"
|
|
||||||
env | grep -v TOKEN
|
|
||||||
echo
|
|
||||||
echo "==> /etc/os-release"
|
|
||||||
cat /etc/os-release || true
|
|
||||||
echo
|
|
||||||
echo "==> /etc/lsb-release"
|
|
||||||
cat /etc/lsb-release || true
|
|
||||||
echo
|
|
||||||
echo "==> /etc/issue"
|
|
||||||
cat /etc/issue || true
|
|
||||||
echo
|
|
||||||
|
|
||||||
# fix permissions so Homebrew and Bundler don't complain
|
# fix permissions so Homebrew and Bundler don't complain
|
||||||
sudo chmod -R g-w,o-w /home/linuxbrew
|
sudo chmod -R g-w,o-w /home/linuxbrew
|
||||||
|
|
||||||
|
# everything below is too slow to do unless prebuilding so skip it
|
||||||
|
if [ -z "$CODESPACES_PREBUILD_TOKEN" ]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# install Homebrew's development gems
|
# install Homebrew's development gems
|
||||||
brew install-bundler-gems --groups=sorbet
|
brew install-bundler-gems --groups=sorbet
|
||||||
|
|
||||||
|
8
.github/workflows/tests.yml
vendored
8
.github/workflows/tests.yml
vendored
@ -12,6 +12,7 @@ permissions:
|
|||||||
env:
|
env:
|
||||||
HOMEBREW_DEVELOPER: 1
|
HOMEBREW_DEVELOPER: 1
|
||||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
|
HOMEBREW_NO_ENV_HINTS: 1
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "${{ github.ref }}"
|
group: "${{ github.ref }}"
|
||||||
@ -235,10 +236,9 @@ jobs:
|
|||||||
- name: tests (Ubuntu 22.04)
|
- name: tests (Ubuntu 22.04)
|
||||||
test-flags: --online --coverage
|
test-flags: --online --coverage
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
# Enable later once this can be fixed.
|
- name: tests (Ubuntu 18.04)
|
||||||
# - name: tests (Ubuntu 18.04)
|
test-flags: --online --coverage
|
||||||
# test-flags: --online --coverage
|
runs-on: ubuntu-18.04
|
||||||
# runs-on: ubuntu-18.04
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Homebrew
|
- name: Set up Homebrew
|
||||||
id: set-up-homebrew
|
id: set-up-homebrew
|
||||||
|
@ -93,55 +93,7 @@ module Homebrew
|
|||||||
require "byebug" if args.byebug?
|
require "byebug" if args.byebug?
|
||||||
|
|
||||||
HOMEBREW_LIBRARY_PATH.cd do
|
HOMEBREW_LIBRARY_PATH.cd do
|
||||||
# Cleanup any unwanted user configuration.
|
setup_environment!(args)
|
||||||
allowed_test_env = %w[
|
|
||||||
HOMEBREW_GITHUB_API_TOKEN
|
|
||||||
HOMEBREW_CACHE
|
|
||||||
HOMEBREW_LOGS
|
|
||||||
HOMEBREW_TEMP
|
|
||||||
HOMEBREW_USE_RUBY_FROM_PATH
|
|
||||||
]
|
|
||||||
Homebrew::EnvConfig::ENVS.keys.map(&:to_s).each do |env|
|
|
||||||
next if allowed_test_env.include?(env)
|
|
||||||
|
|
||||||
ENV.delete(env)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Codespaces /tmp is mounted 755 which makes Ruby warn constantly.
|
|
||||||
if (ENV["HOMEBREW_CODESPACES"] == "true") && (HOMEBREW_TEMP.to_s == "/tmp")
|
|
||||||
homebrew_prefix_tmp = "#{HOMEBREW_PREFIX}/tmp"
|
|
||||||
ENV["HOMEBREW_TEMP"] = homebrew_prefix_tmp
|
|
||||||
FileUtils.mkdir_p homebrew_prefix_tmp
|
|
||||||
system "chmod", "-R", "g-w,o-w", "/tmp"
|
|
||||||
end
|
|
||||||
|
|
||||||
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
|
|
||||||
ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat?
|
|
||||||
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic?
|
|
||||||
ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online?
|
|
||||||
ENV["HOMEBREW_SORBET_RUNTIME"] = "1"
|
|
||||||
|
|
||||||
ENV["USER"] ||= system_command!("id", args: ["-nu"]).stdout.chomp
|
|
||||||
|
|
||||||
# Avoid local configuration messing with tests, e.g. git being configured
|
|
||||||
# to use GPG to sign by default
|
|
||||||
ENV["HOME"] = "#{HOMEBREW_LIBRARY_PATH}/test"
|
|
||||||
|
|
||||||
# Print verbose output when requesting debug or verbose output.
|
|
||||||
ENV["HOMEBREW_VERBOSE_TESTS"] = "1" if args.debug? || args.verbose?
|
|
||||||
|
|
||||||
if args.coverage?
|
|
||||||
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
|
|
||||||
FileUtils.rm_f "test/coverage/.resultset.json"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Override author/committer as global settings might be invalid and thus
|
|
||||||
# will cause silent failure during the setup of dummy Git repositories.
|
|
||||||
%w[AUTHOR COMMITTER].each do |role|
|
|
||||||
ENV["GIT_#{role}_NAME"] = "brew tests"
|
|
||||||
ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost"
|
|
||||||
ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000"
|
|
||||||
end
|
|
||||||
|
|
||||||
parallel = true
|
parallel = true
|
||||||
|
|
||||||
@ -237,4 +189,59 @@ module Homebrew
|
|||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def setup_environment!(args)
|
||||||
|
# Cleanup any unwanted user configuration.
|
||||||
|
allowed_test_env = %w[
|
||||||
|
HOMEBREW_GITHUB_API_TOKEN
|
||||||
|
HOMEBREW_CACHE
|
||||||
|
HOMEBREW_LOGS
|
||||||
|
HOMEBREW_TEMP
|
||||||
|
HOMEBREW_USE_RUBY_FROM_PATH
|
||||||
|
]
|
||||||
|
Homebrew::EnvConfig::ENVS.keys.map(&:to_s).each do |env|
|
||||||
|
next if allowed_test_env.include?(env)
|
||||||
|
|
||||||
|
ENV.delete(env)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Codespaces HOMEBREW_PREFIX and /tmp are mounted 755 which makes Ruby warn constantly.
|
||||||
|
if (ENV["HOMEBREW_CODESPACES"] == "true") && (HOMEBREW_TEMP.to_s == "/tmp")
|
||||||
|
# Need to keep this fairly short to avoid socket paths being too long in tests.
|
||||||
|
homebrew_prefix_tmp = "/home/linuxbrew/tmp"
|
||||||
|
ENV["HOMEBREW_TEMP"] = homebrew_prefix_tmp
|
||||||
|
FileUtils.mkdir_p homebrew_prefix_tmp
|
||||||
|
system "chmod", "-R", "g-w,o-w", HOMEBREW_PREFIX, homebrew_prefix_tmp
|
||||||
|
end
|
||||||
|
|
||||||
|
ENV["HOMEBREW_TESTS"] = "1"
|
||||||
|
ENV["HOMEBREW_NO_AUTO_UPDATE"] = "1"
|
||||||
|
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
|
||||||
|
ENV["HOMEBREW_NO_COMPAT"] = "1" if args.no_compat?
|
||||||
|
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if args.generic?
|
||||||
|
ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online?
|
||||||
|
ENV["HOMEBREW_SORBET_RUNTIME"] = "1"
|
||||||
|
|
||||||
|
ENV["USER"] ||= system_command!("id", args: ["-nu"]).stdout.chomp
|
||||||
|
|
||||||
|
# Avoid local configuration messing with tests, e.g. git being configured
|
||||||
|
# to use GPG to sign by default
|
||||||
|
ENV["HOME"] = "#{HOMEBREW_LIBRARY_PATH}/test"
|
||||||
|
|
||||||
|
# Print verbose output when requesting debug or verbose output.
|
||||||
|
ENV["HOMEBREW_VERBOSE_TESTS"] = "1" if args.debug? || args.verbose?
|
||||||
|
|
||||||
|
if args.coverage?
|
||||||
|
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
|
||||||
|
FileUtils.rm_f "test/coverage/.resultset.json"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Override author/committer as global settings might be invalid and thus
|
||||||
|
# will cause silent failure during the setup of dummy Git repositories.
|
||||||
|
%w[AUTHOR COMMITTER].each do |role|
|
||||||
|
ENV["GIT_#{role}_NAME"] = "brew tests"
|
||||||
|
ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost"
|
||||||
|
ENV["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -99,12 +99,17 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def build_system_too_old?
|
def needs_build_formulae?
|
||||||
|
needs_libc_formula? || needs_compiler_formula?
|
||||||
|
end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
|
def needs_libc_formula?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def system_gcc_too_old?
|
def needs_compiler_formula?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,20 +13,22 @@ class DependencyCollector
|
|||||||
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
||||||
def gcc_dep_if_needed(related_formula_names)
|
def gcc_dep_if_needed(related_formula_names)
|
||||||
# gcc is required for libgcc_s.so.1 if glibc or gcc are too old
|
# gcc is required for libgcc_s.so.1 if glibc or gcc are too old
|
||||||
return unless DevelopmentTools.build_system_too_old?
|
return unless DevelopmentTools.needs_build_formulae?
|
||||||
return if building_global_dep_tree?
|
return if building_global_dep_tree?
|
||||||
return if related_formula_names.include?(GCC)
|
return if related_formula_names.include?(GCC)
|
||||||
return if global_dep_tree[GCC]&.intersect?(related_formula_names)
|
return if global_dep_tree[GCC]&.intersect?(related_formula_names)
|
||||||
|
return unless formula_for(GCC)
|
||||||
|
|
||||||
Dependency.new(GCC)
|
Dependency.new(GCC)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
||||||
def glibc_dep_if_needed(related_formula_names)
|
def glibc_dep_if_needed(related_formula_names)
|
||||||
return unless OS::Linux::Glibc.below_ci_version?
|
return unless DevelopmentTools.needs_libc_formula?
|
||||||
return if building_global_dep_tree?
|
return if building_global_dep_tree?
|
||||||
return if related_formula_names.include?(GLIBC)
|
return if related_formula_names.include?(GLIBC)
|
||||||
return if global_dep_tree[GLIBC]&.intersect?(related_formula_names)
|
return if global_dep_tree[GLIBC]&.intersect?(related_formula_names)
|
||||||
|
return unless formula_for(GLIBC)
|
||||||
|
|
||||||
Dependency.new(GLIBC)
|
Dependency.new(GLIBC)
|
||||||
end
|
end
|
||||||
@ -38,7 +40,7 @@ class DependencyCollector
|
|||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def init_global_dep_tree_if_needed!
|
def init_global_dep_tree_if_needed!
|
||||||
return unless DevelopmentTools.build_system_too_old?
|
return unless DevelopmentTools.needs_build_formulae?
|
||||||
return if building_global_dep_tree?
|
return if building_global_dep_tree?
|
||||||
return unless global_dep_tree.empty?
|
return unless global_dep_tree.empty?
|
||||||
|
|
||||||
@ -49,15 +51,27 @@ class DependencyCollector
|
|||||||
built_global_dep_tree!
|
built_global_dep_tree!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(name: String).returns(T.nilable(Formula)) }
|
||||||
|
def formula_for(name)
|
||||||
|
@formula_for ||= {}
|
||||||
|
@formula_for[name] ||= Formula[name]
|
||||||
|
rescue FormulaUnavailableError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
sig { params(name: String).returns(T::Array[String]) }
|
sig { params(name: String).returns(T::Array[String]) }
|
||||||
def global_deps_for(name)
|
def global_deps_for(name)
|
||||||
@global_deps_for ||= {}
|
@global_deps_for ||= {}
|
||||||
# Always strip out glibc and gcc from all parts of dependency tree when
|
# Always strip out glibc and gcc from all parts of dependency tree when
|
||||||
# we're calculating their dependency trees. Other parts of Homebrew will
|
# we're calculating their dependency trees. Other parts of Homebrew will
|
||||||
# catch any circular dependencies.
|
# catch any circular dependencies.
|
||||||
@global_deps_for[name] ||= Formula[name].deps.map(&:name).flat_map do |dep|
|
@global_deps_for[name] ||= if (formula = formula_for(name))
|
||||||
[dep, *global_deps_for(dep)].compact
|
formula.deps.map(&:name).flat_map do |dep|
|
||||||
end.uniq
|
[dep, *global_deps_for(dep)].compact
|
||||||
|
end.uniq
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use class variables to avoid this expensive logic needing to be done more
|
# Use class variables to avoid this expensive logic needing to be done more
|
||||||
|
@ -8,10 +8,10 @@ class DevelopmentTools
|
|||||||
sig { params(tool: String).returns(T.nilable(Pathname)) }
|
sig { params(tool: String).returns(T.nilable(Pathname)) }
|
||||||
def locate(tool)
|
def locate(tool)
|
||||||
(@locate ||= {}).fetch(tool) do |key|
|
(@locate ||= {}).fetch(tool) do |key|
|
||||||
@locate[key] = if build_system_too_old? &&
|
@locate[key] = if needs_build_formulae? &&
|
||||||
(binutils_path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable?
|
(binutils_path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable?
|
||||||
binutils_path
|
binutils_path
|
||||||
elsif build_system_too_old? && (glibc_path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?
|
elsif needs_build_formulae? && (glibc_path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?
|
||||||
glibc_path
|
glibc_path
|
||||||
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
|
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
|
||||||
homebrew_path
|
homebrew_path
|
||||||
@ -27,18 +27,22 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def build_system_too_old?
|
def needs_libc_formula?
|
||||||
return @build_system_too_old if defined? @build_system_too_old
|
return @needs_libc_formula if defined? @needs_libc_formula
|
||||||
|
|
||||||
@build_system_too_old = (system_gcc_too_old? || OS::Linux::Glibc.below_ci_version?)
|
@needs_libc_formula = OS::Linux::Glibc.below_ci_version?
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def system_gcc_too_old?
|
def needs_compiler_formula?
|
||||||
gcc = "/usr/bin/gcc"
|
return @needs_compiler_formula if defined? @needs_compiler_formula
|
||||||
return true unless File.exist?(gcc)
|
|
||||||
|
|
||||||
gcc_version(gcc) < OS::LINUX_GCC_CI_VERSION
|
gcc = "/usr/bin/gcc"
|
||||||
|
@needs_compiler_formula = if File.exist?(gcc)
|
||||||
|
gcc_version(gcc) < OS::LINUX_GCC_CI_VERSION
|
||||||
|
else
|
||||||
|
true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Hash[String, T.nilable(String)]) }
|
sig { returns(T::Hash[String, T.nilable(String)]) }
|
||||||
|
@ -27,7 +27,7 @@ class Formula
|
|||||||
|
|
||||||
sig { params(spec: SoftwareSpec).void }
|
sig { params(spec: SoftwareSpec).void }
|
||||||
def add_global_deps_to_spec(spec)
|
def add_global_deps_to_spec(spec)
|
||||||
return unless DevelopmentTools.build_system_too_old?
|
return unless DevelopmentTools.needs_build_formulae?
|
||||||
|
|
||||||
@global_deps ||= begin
|
@global_deps ||= begin
|
||||||
dependency_collector = spec.dependency_collector
|
dependency_collector = spec.dependency_collector
|
||||||
|
@ -246,7 +246,7 @@ class FormulaInstaller
|
|||||||
if Homebrew.default_prefix? &&
|
if Homebrew.default_prefix? &&
|
||||||
!build_from_source? && !build_bottle? && !formula.head? && formula.tap&.core_tap? &&
|
!build_from_source? && !build_bottle? && !formula.head? && formula.tap&.core_tap? &&
|
||||||
# Integration tests override homebrew-core locations
|
# Integration tests override homebrew-core locations
|
||||||
ENV["HOMEBREW_TEST_TMPDIR"].nil? &&
|
ENV["HOMEBREW_INTEGRATION_TEST"].nil? &&
|
||||||
!pour_bottle?
|
!pour_bottle?
|
||||||
message = if !formula.pour_bottle? && formula.pour_bottle_check_unsatisfied_reason
|
message = if !formula.pour_bottle? && formula.pour_bottle_check_unsatisfied_reason
|
||||||
formula_message = formula.pour_bottle_check_unsatisfied_reason
|
formula_message = formula.pour_bottle_check_unsatisfied_reason
|
||||||
|
@ -797,6 +797,9 @@ class CoreTap < Tap
|
|||||||
return if instance.installed?
|
return if instance.installed?
|
||||||
return if Homebrew::EnvConfig.install_from_api?
|
return if Homebrew::EnvConfig.install_from_api?
|
||||||
|
|
||||||
|
# Tests override homebrew-core locations and we don't want to auto-tap in them.
|
||||||
|
return if ENV["HOMEBREW_TESTS"]
|
||||||
|
|
||||||
safe_system HOMEBREW_BREW_FILE, "tap", instance.name
|
safe_system HOMEBREW_BREW_FILE, "tap", instance.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -130,6 +130,11 @@ describe Caveats do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when f.service is not nil" do
|
context "when f.service is not nil" do
|
||||||
|
before do
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("launchctl").and_return(true)
|
||||||
|
allow_any_instance_of(Object).to receive(:which).with("systemctl").and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
it "prints warning when no service deamon is found" do
|
it "prints warning when no service deamon is found" do
|
||||||
f = formula do
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
@ -259,6 +264,10 @@ describe Caveats do
|
|||||||
let(:path) { f.prefix.resolved_path }
|
let(:path) { f.prefix.resolved_path }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
|
|
||||||
allow_any_instance_of(Pathname).to receive(:children).and_return([Pathname.new("child")])
|
allow_any_instance_of(Pathname).to receive(:children).and_return([Pathname.new("child")])
|
||||||
allow_any_instance_of(Object).to receive(:which).with(any_args).and_return(Pathname.new("shell"))
|
allow_any_instance_of(Object).to receive(:which).with(any_args).and_return(Pathname.new("shell"))
|
||||||
allow(Utils::Shell).to receive(:preferred).and_return(nil)
|
allow(Utils::Shell).to receive(:preferred).and_return(nil)
|
||||||
|
@ -6,7 +6,7 @@ require "cmd/shared_examples/args_parse"
|
|||||||
describe "brew tap-info" do
|
describe "brew tap-info" do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
|
|
||||||
it "gets information for a given Tap", :integration_test do
|
it "gets information for a given Tap", :integration_test, :needs_network do
|
||||||
setup_test_tap
|
setup_test_tap
|
||||||
|
|
||||||
expect { brew "tap-info", "--json=v1", "--installed" }
|
expect { brew "tap-info", "--json=v1", "--installed" }
|
||||||
|
@ -1202,6 +1202,9 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
specify "it warns when another formula does not have a symmetric conflict" do
|
specify "it warns when another formula does not have a symmetric conflict" do
|
||||||
|
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
||||||
|
stub_formula_loader formula("glibc") { url "glibc-1.0" }
|
||||||
|
|
||||||
foo = formula("foo") do
|
foo = formula("foo") do
|
||||||
url "https://brew.sh/foo-1.0.tgz"
|
url "https://brew.sh/foo-1.0.tgz"
|
||||||
end
|
end
|
||||||
|
@ -22,9 +22,9 @@ describe FormulaInstaller do
|
|||||||
expect(formula).to be_bottled
|
expect(formula).to be_bottled
|
||||||
expect(formula).to pour_bottle
|
expect(formula).to pour_bottle
|
||||||
|
|
||||||
stub_formula_loader formula
|
|
||||||
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
||||||
stub_formula_loader formula("gcc@11") { url "gcc-11.0" }
|
stub_formula_loader formula("glibc") { url "glibc-1.0" }
|
||||||
|
stub_formula_loader formula
|
||||||
|
|
||||||
fi = FormulaInstaller.new(formula)
|
fi = FormulaInstaller.new(formula)
|
||||||
fi.fetch
|
fi.fetch
|
||||||
|
@ -150,6 +150,10 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
|
|
||||||
allow(Formulary).to receive(:load_formula_from_path).with(f2.name, f2.path).and_return(f2)
|
allow(Formulary).to receive(:load_formula_from_path).with(f2.name, f2.path).and_return(f2)
|
||||||
allow(Formulary).to receive(:factory).with(f2.name).and_return(f2)
|
allow(Formulary).to receive(:factory).with(f2.name).and_return(f2)
|
||||||
allow(f.tap).to receive(:versioned_formula_files).and_return([f2.path])
|
allow(f.tap).to receive(:versioned_formula_files).and_return([f2.path])
|
||||||
@ -740,6 +744,10 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
|
|
||||||
specify "dependencies" do
|
specify "dependencies" do
|
||||||
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
|
|
||||||
f1 = formula "f1" do
|
f1 = formula "f1" do
|
||||||
url "f1-1.0"
|
url "f1-1.0"
|
||||||
end
|
end
|
||||||
@ -782,6 +790,10 @@ describe Formula do
|
|||||||
specify "runtime dependencies with optional deps from tap" do
|
specify "runtime dependencies with optional deps from tap" do
|
||||||
tap_loader = double
|
tap_loader = double
|
||||||
|
|
||||||
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
|
|
||||||
allow(tap_loader).to receive(:get_formula).and_raise(RuntimeError, "tried resolving tap formula")
|
allow(tap_loader).to receive(:get_formula).and_raise(RuntimeError, "tried resolving tap formula")
|
||||||
allow(Formulary).to receive(:loader_for).with("foo/bar/f1", from: nil).and_return(tap_loader)
|
allow(Formulary).to receive(:loader_for).with("foo/bar/f1", from: nil).and_return(tap_loader)
|
||||||
stub_formula_loader(formula("f2") { url("f2-1.0") }, "baz/qux/f2")
|
stub_formula_loader(formula("f2") { url("f2-1.0") }, "baz/qux/f2")
|
||||||
@ -831,6 +843,10 @@ describe Formula do
|
|||||||
end
|
end
|
||||||
|
|
||||||
specify "requirements" do
|
specify "requirements" do
|
||||||
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
|
|
||||||
f1 = formula "f1" do
|
f1 = formula "f1" do
|
||||||
url "f1-1"
|
url "f1-1"
|
||||||
|
|
||||||
|
@ -141,8 +141,10 @@ describe Formulary do
|
|||||||
context "with installed Formula" do
|
context "with installed Formula" do
|
||||||
before do
|
before do
|
||||||
allow(described_class).to receive(:loader_for).and_call_original
|
allow(described_class).to receive(:loader_for).and_call_original
|
||||||
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
|
||||||
stub_formula_loader formula("gcc@11") { url "gcc-11.0" }
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:installed_formula) { described_class.factory(formula_path) }
|
let(:installed_formula) { described_class.factory(formula_path) }
|
||||||
@ -283,6 +285,10 @@ describe Formulary do
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
allow(described_class).to receive(:loader_for).and_return(described_class::FormulaAPILoader.new(formula_name))
|
allow(described_class).to receive(:loader_for).and_return(described_class::FormulaAPILoader.new(formula_name))
|
||||||
|
|
||||||
|
# don't try to load/fetch gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns a Formula when given a name" do
|
it "returns a Formula when given a name" do
|
||||||
|
@ -18,6 +18,8 @@ describe InstalledDependents do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def setup_test_keg(name, version, &block)
|
def setup_test_keg(name, version, &block)
|
||||||
|
stub_formula("gcc")
|
||||||
|
stub_formula("glibc")
|
||||||
stub_formula(name, version, &block)
|
stub_formula(name, version, &block)
|
||||||
|
|
||||||
path = HOMEBREW_CELLAR/name/version
|
path = HOMEBREW_CELLAR/name/version
|
||||||
|
@ -33,6 +33,7 @@ describe Language::Perl::Shebang do
|
|||||||
|
|
||||||
describe "#detected_perl_shebang" do
|
describe "#detected_perl_shebang" do
|
||||||
it "can be used to replace Perl shebangs" do
|
it "can be used to replace Perl shebangs" do
|
||||||
|
allow(Formulary).to receive(:factory)
|
||||||
allow(Formulary).to receive(:factory).with(perl_f.name).and_return(perl_f)
|
allow(Formulary).to receive(:factory).with(perl_f.name).and_return(perl_f)
|
||||||
Utils::Shebang.rewrite_shebang described_class.detected_perl_shebang(f), file
|
Utils::Shebang.rewrite_shebang described_class.detected_perl_shebang(f), file
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ describe Language::Python::Shebang do
|
|||||||
|
|
||||||
describe "#detected_python_shebang" do
|
describe "#detected_python_shebang" do
|
||||||
it "can be used to replace Python shebangs" do
|
it "can be used to replace Python shebangs" do
|
||||||
expect(Formulary).to receive(:factory).with(python_f.name).and_return(python_f)
|
allow(Formulary).to receive(:factory)
|
||||||
|
allow(Formulary).to receive(:factory).with(python_f.name).and_return(python_f)
|
||||||
Utils::Shebang.rewrite_shebang described_class.detected_python_shebang(f, use_python_from_path: false), file
|
Utils::Shebang.rewrite_shebang described_class.detected_python_shebang(f, use_python_from_path: false), file
|
||||||
|
|
||||||
expect(File.read(file)).to eq <<~EOS
|
expect(File.read(file)).to eq <<~EOS
|
||||||
|
@ -43,12 +43,14 @@ RSpec.shared_context "integration test" do # rubocop:disable RSpec/ContextWordin
|
|||||||
end
|
end
|
||||||
|
|
||||||
around do |example|
|
around do |example|
|
||||||
|
ENV["HOMEBREW_INTEGRATION_TEST"] = "1"
|
||||||
(HOMEBREW_PREFIX/"bin").mkpath
|
(HOMEBREW_PREFIX/"bin").mkpath
|
||||||
FileUtils.touch HOMEBREW_PREFIX/"bin/brew"
|
FileUtils.touch HOMEBREW_PREFIX/"bin/brew"
|
||||||
|
|
||||||
example.run
|
example.run
|
||||||
ensure
|
ensure
|
||||||
FileUtils.rm_rf HOMEBREW_PREFIX/"bin"
|
FileUtils.rm_rf HOMEBREW_PREFIX/"bin"
|
||||||
|
ENV.delete("HOMEBREW_INTEGRATION_TEST")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate unique ID to be able to
|
# Generate unique ID to be able to
|
||||||
|
@ -248,6 +248,10 @@ describe Tab do
|
|||||||
# < 1.1.7 runtime dependencies were wrong so are ignored
|
# < 1.1.7 runtime dependencies were wrong so are ignored
|
||||||
stub_const("HOMEBREW_VERSION", "1.1.7")
|
stub_const("HOMEBREW_VERSION", "1.1.7")
|
||||||
|
|
||||||
|
# don't try to load gcc/glibc
|
||||||
|
allow(DevelopmentTools).to receive(:needs_libc_formula?).and_return(false)
|
||||||
|
allow(DevelopmentTools).to receive(:needs_compiler_formula?).and_return(false)
|
||||||
|
|
||||||
f = formula do
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
depends_on "bar"
|
depends_on "bar"
|
||||||
|
@ -258,8 +258,7 @@ describe Tap do
|
|||||||
expect(homebrew_foo_tap.git_last_commit).to match(/\A\d+ .+ ago\Z/)
|
expect(homebrew_foo_tap.git_last_commit).to match(/\A\d+ .+ ago\Z/)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#private?" do
|
specify "#private?", :needs_network do
|
||||||
skip "HOMEBREW_GITHUB_API_TOKEN is required" unless GitHub::API.credentials
|
|
||||||
expect(homebrew_foo_tap).to be_private
|
expect(homebrew_foo_tap).to be_private
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user