Commit 1bea3e6a authored by Jérémy Bobbio's avatar Jérémy Bobbio

Add a patch to make the test suite work under autopkgtest

parent 48162168
fix-collision-with-hash-function
use-system-library-paths-when-running-under-autopkgtest
Description: Use system library paths when running under autopkgtest
Author: Jérémy Bobbio <lunar@debian.org>
Forwarded: not-needed
Last-Update: 2015-09-09
diff --git a/test/_backport_guards_test.rb b/test/_backport_guards_test.rb
index ee05355..39d5250 100644
--- a/test/_backport_guards_test.rb
+++ b/test/_backport_guards_test.rb
@@ -80,6 +80,14 @@ class AAA_TestBackportGuards < Test::Unit::TestCase
delta unless delta.empty?
end
+ def lib_path(path)
+ unless ENV['ADTTMP'].nil? # running under autopkgtest
+ "/usr/lib/ruby/vendor_ruby/#{path}"
+ else
+ File.expand_path("../../lib/#{path}", __FILE__)
+ end
+ end
+
# Order super important!
def test__1_abbrev_can_be_required_before_backports
assert require('abbrev')
@@ -103,7 +111,7 @@ class AAA_TestBackportGuards < Test::Unit::TestCase
end
def test_setlib_load_correctly_after_requiring_backports
- path = File.expand_path("../../lib/backports/1.9.2/stdlib/matrix.rb", __FILE__)
+ path = lib_path('backports/1.9.2/stdlib/matrix.rb')
assert_equal false, $LOADED_FEATURES.include?(path)
assert_equal true, require('matrix')
assert_equal true, $bogus.include?("matrix")
@@ -113,7 +121,7 @@ class AAA_TestBackportGuards < Test::Unit::TestCase
def test_setlib_load_correctly_before_requiring_backports_test
assert_equal true, $bogus.include?("abbrev")
- path = File.expand_path("../../lib/backports/2.0.0/stdlib/abbrev.rb", __FILE__)
+ path = lib_path('backports/2.0.0/stdlib/abbrev.rb')
assert_equal true, $LOADED_FEATURES.include?(path)
assert_equal false, require('abbrev')
end
@@ -124,7 +132,7 @@ class AAA_TestBackportGuards < Test::Unit::TestCase
end
def test_load_correctly_new_libraries_test
- path = File.expand_path("../../lib/backports/2.0.0/stdlib/fake_stdlib_lib.rb", __FILE__)
+ path = lib_path('backports/2.0.0/stdlib/fake_stdlib_lib.rb')
assert_equal false, $LOADED_FEATURES.include?(path)
assert_equal true, require('fake_stdlib_lib')
assert_equal true, $LOADED_FEATURES.include?(path)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment