From 4b40a87ca40f878affdfb9d2464ec8ea1246d9d2 Mon Sep 17 00:00:00 2001 From: Andrea Kao <eirinikos@gmail.com> Date: Tue, 19 Jul 2016 08:23:44 -0700 Subject: [PATCH] tests: nest HOMEBREW_TEMP inside TEST_TMPDIR (#554) --- Library/Homebrew/test/lib/config.rb | 4 ++-- Library/Homebrew/test/test_integration_cmds.rb | 1 + Library/Homebrew/test/testing_env.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/test/lib/config.rb b/Library/Homebrew/test/lib/config.rb index 062bed33b6..5818aec418 100644 --- a/Library/Homebrew/test/lib/config.rb +++ b/Library/Homebrew/test/lib/config.rb @@ -2,10 +2,9 @@ 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) + dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp") at_exit { FileUtils.remove_entry(dir) } ENV[k] = dir } @@ -24,6 +23,7 @@ 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" +HOMEBREW_TEMP = HOMEBREW_PREFIX.parent+"temp" TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37" TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b" diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index c020deaf49..07068019f6 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -18,6 +18,7 @@ class IntegrationCommandTests < Homebrew::TestCase HOMEBREW_CACHE.children, HOMEBREW_LOCK_DIR.children, HOMEBREW_LOGS.children, + HOMEBREW_TEMP.children, HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"share", HOMEBREW_PREFIX/"opt", diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index 887cb2dbb7..72847953d1 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -7,7 +7,7 @@ require "formulary" # Test environment setup (HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-core/Formula").mkpath -%w[cache formula_cache locks cellar logs].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath } +%w[cache formula_cache locks cellar logs temp].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath } # Test fixtures and files can be found relative to this path TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__)) -- GitLab