File: use-system-library-paths-when-running-under-autopkgtest

package info (click to toggle)
ruby-backports 3.6.8-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,480 kB
  • ctags: 702
  • sloc: ruby: 6,198; makefile: 24
file content (51 lines) | stat: -rw-r--r-- 2,095 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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)