Martin Afanasjew 9e021aa661 test/lib/config: group paths by persistence
Rearrange path constants such that persistent paths (that point into the
Homebrew code base) are in one spot and all other paths (that are being
redirected to a temporary location for the duration of the test run) are
grouped together.

Closes #440.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-07-05 20:09:07 +02:00

33 lines
1.5 KiB
Ruby

require "tmpdir"
require "pathname"
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
HOMEBREW_TEMP = Pathname.new(ENV["HOMEBREW_TEMP"] || Dir.tmpdir)
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") { |k|
dir = Dir.mktmpdir("homebrew_tests", HOMEBREW_TEMP)
at_exit { FileUtils.remove_entry(dir) }
ENV[k] = dir
}
# Paths pointing into the Homebrew code base that persist across test runs
HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__))
HOMEBREW_ENV_PATH = HOMEBREW_LIBRARY_PATH.parent+"ENV"
HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":")
# Paths redirected to a temporary directory and wiped at the end of the test run
HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix")
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+"Library"
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+"cache"
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache"
HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX.parent+"locks"
HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar"
HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37"
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b"
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9"
PATCH_A_SHA256 = "83404f4936d3257e65f176c4ffb5a5b8d6edd644a21c8d8dcc73e22a6d28fcfa"
PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b90"