Explorar el Código

Add first test cases for Dpkg::Shlibs

Currently only tests parse_ldso_conf since find_library is
difficult to test.
Frank Lichtenheld hace 19 años
padre
commit
b4dac9dfb9

+ 0 - 3
scripts/t/100_Dpkg_Version.t

@@ -5,9 +5,6 @@ use Test::More;
 use warnings;
 use strict;
 
-use utf8;
-use Encode;
-
 # Default cmp '>'
 my @versions = ({a      => '1.0-1',
 		 b      => '2.0-2',

+ 18 - 0
scripts/t/200_Dpkg_Shlibs.t

@@ -0,0 +1,18 @@
+# -*- mode: cperl;-*-
+
+use Test::More tests => 2;
+
+use warnings;
+use strict;
+
+use_ok('Dpkg::Shlibs');
+
+my @save_paths = @Dpkg::Shlibs::librarypaths;
+@Dpkg::Shlibs::librarypaths = ();
+
+Dpkg::Shlibs::parse_ldso_conf("t/200_Dpkg_Shlibs/ld.so.conf");
+
+use Data::Dumper;
+is_deeply([qw(/nonexistant32 /nonexistant/lib64
+	     /usr/local/lib /nonexistant/lib128 )],
+	  \@Dpkg::Shlibs::librarypaths, "parsed library paths");

+ 9 - 0
scripts/t/200_Dpkg_Shlibs/ld.so.conf

@@ -0,0 +1,9 @@
+# Comment and empty line
+
+# Paths
+/nonexistant32
+/nonexistant/lib64
+
+include /nonexistant/*.conf
+include t/200_Dpkg_Shlibs/ld.so.conf.d/*.conf
+

+ 1 - 0
scripts/t/200_Dpkg_Shlibs/ld.so.conf.d/inf_recurse.conf

@@ -0,0 +1 @@
+include t/200_Dpkg_Shlibs/ld.so.conf

+ 1 - 0
scripts/t/200_Dpkg_Shlibs/ld.so.conf.d/normal.conf

@@ -0,0 +1 @@
+/usr/local/lib/

+ 1 - 0
scripts/t/200_Dpkg_Shlibs/ld.so.conf.d/recursive.conf

@@ -0,0 +1 @@
+include t/200_Dpkg_Shlibs/ld.so.conf_2

+ 1 - 0
scripts/t/200_Dpkg_Shlibs/ld.so.conf_2

@@ -0,0 +1 @@
+/nonexistant/lib128