This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add lib to @INC in t/base/rs.t
authorFather Chrysostomos <sprout@cpan.org>
Wed, 22 Sep 2010 20:10:19 +0000 (13:10 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 22 Sep 2010 20:10:19 +0000 (13:10 -0700)
t/base/rs.t needs to @INClude the lib directory before requiring
PerlIO::scalar, even if the require is in an eval, because it will
otherwise pick up a previously-installed copy.

Since 87b9e1600 (Eliminate PL_* accessor functions under ithreads), a
binary-incompatible change, I’ve been getting these errors:

t/base/rs......................................................dyld: lazy symbol binding failed: Symbol not found: _Perl_Istack_sp_ptr
  Referenced from: /usr/local/lib/perl5/5.13.5/darwin-thread-multi-2level/auto/PerlIO/scalar/scalar.bundle
  Expected in: dynamic lookup

dyld: Symbol not found: _Perl_Istack_sp_ptr
  Referenced from: /usr/local/lib/perl5/5.13.5/darwin-thread-multi-2level/auto/PerlIO/scalar/scalar.bundle
  Expected in: dynamic lookup

FAILED--no leader found
Failed a basic test (base/rs.t) -- cannot continue.
make: *** [test] Error 255

t/base/rs.t

index 51681e9..ab41652 100644 (file)
@@ -115,7 +115,12 @@ $/ = "\n";
 }
 
 
-if (not eval q/use PerlIO::scalar; use PerlIO::via::scalar; 1/) {
+{
+ # If we do not include the lib directories, we may end up picking up a
+ # binary-incompatible previously-installed version. The eval won’t help in
+ # intercepting a SIGTRAP.
+ local @INC = ("../lib", "lib", @INC);
+ if (not eval q/use PerlIO::scalar; use PerlIO::via::scalar; 1/) {
   # In-memory files necessitate PerlIO::via::scalar, thus a perl with
   # perlio and dynaloading enabled. miniperl won't be able to run this
   # test, so skip it
@@ -127,8 +132,8 @@ if (not eval q/use PerlIO::scalar; use PerlIO::via::scalar; 1/) {
     print "ok $test # skipped - Can't test in memory file with miniperl/without PerlIO::Scalar\n";
     $test_count++;
   }
-}
-else {
+ }
+ else {
   # Test if a file in memory behaves the same as a real file (= re-run the test with a file in memory)
   open TESTFILE, "<", \$teststring;
   test_string(*TESTFILE);
@@ -137,6 +142,7 @@ else {
   open TESTFILE, "<", \$teststring2;
   test_record(*TESTFILE);
   close TESTFILE;
+ }
 }
 
 # Get rid of the temp file