Subject: | xblk.t tests are not being skipped despite lack of bulk API |
This is a patch to detect whether BLK API is available.
I'm running on Windows, using FreeTDS, against SQL Server. 6 xblk.t tests are failing; I have no BLK API. The tests should all be skipped by virtue of
skip 'No BLK library available.', 59 unless $dbh->{syb_has_blk};
(xblk.t, line 61)
but they are not being skipped. It turns out that the build procedure on Windows doesn't detect the lack of libblk and hence doesn't pass -DNO_BLK=1 to the makefile.
The fix is to generalise how the build procedure handles this on Linux:
--- Makefile#9.PL 2014-02-14 21:45:56.000000000 +-0100
+++ Makefile#11.PL 2014-02-14 22:09:38.000000000 +-0100
@@ -181,12 +181,19 @@
# }
checkChainedAutoCommit();
# print "OS = $^O\n";
+ my %libname = loadSybLibs("$SYBASE/$libdir",
+ $^O eq 'MSWin32' ? qr/lib/ :
+ $^O eq 'VMS' ? qr/olb/ :
+ qr/(?:so|a|sl)/
+ );
+ my $libtype = '';
+
if ( $^O eq 'MSWin32' ) {
if ($version ge '15') {
$lib_string = "-L$SYBASE/$libdir -llibsybct.lib -llibsybcs.lib -llibsybtcl.lib -llibsybcomn.lib -llibsybintl.lib -llibsybblk.lib $attr{EXTRA_LIBS} -lm";
}
else {
$lib_string = "-L$SYBASE/$libdir -llibct.lib -llibcs.lib -llibtcl.lib -llibcomn.lib -llibintl.lib -llibblk.lib $attr{EXTRA_LIBS} -lm";
@@ -187,24 +194,18 @@
if ( $^O eq 'MSWin32' ) {
if ($version ge '15') {
$lib_string = "-L$SYBASE/$libdir -llibsybct.lib -llibsybcs.lib -llibsybtcl.lib -llibsybcomn.lib -llibsybintl.lib -llibsybblk.lib $attr{EXTRA_LIBS} -lm";
}
else {
$lib_string = "-L$SYBASE/$libdir -llibct.lib -llibcs.lib -llibtcl.lib -llibcomn.lib -llibintl.lib -llibblk.lib $attr{EXTRA_LIBS} -lm";
$lib_string =~ s/-l$_/-lsyb$_/;
}
}
elsif ( $^O =~ /linux|freebsd/i ) {
$lib_string =~ s/-ltcl/-lsybtcl/;
}
-
- my %libname;
-
- %libname = loadSybLibs("$SYBASE/$libdir");
-
- my $libtype = '';
# Logic to replace normal libs with _r (re-entrant) libs if
# usethreads is defined provided by W. Phillip Moore (wpm@ms.com)
# I have no idea if this works on Win32 systems (probably not!)
if ( $Config{usethreads} ) {
print "Running in threaded mode - looking for _r libraries...\n";
@@ -231,30 +232,30 @@
# Logic to replace normal libs with _r (re-entrant) libs if
# usethreads is defined provided by W. Phillip Moore (wpm@ms.com)
# I have no idea if this works on Win32 systems (probably not!)
if ( $Config{usethreads} ) {
print "Running in threaded mode - looking for _r libraries...\n";
++$found;
}
if ($found) {
$libtype .= '64';
}
}
+ }
- # Is the blk library available?
- #my @k = keys(%libname);
- #print "@k\n";
- #print "libtype = $libtype\n";
- if ( my @l = grep( /(syb)?blk$libtype/, keys(%libname) ) ) {
- print "BLK api available - found: @l\n";
- }
- else {
- print "BLK api NOT available.\n";
- $inc_string .= ' -DNO_BLK=1';
- }
+ # Is the blk library available?
+ #my @k = keys(%libname);
+ #print "@k\n";
+ #print "libtype = $libtype\n";
+ if ( my @l = grep( /(syb)?blk$libtype/, keys(%libname) ) ) {
+ print "BLK api available - found: @l\n";
+ }
+ else {
+ print "BLK api NOT available.\n";
+ $inc_string .= ' -DNO_BLK=1';
}
my $config_sitearch = $Config{sitearchexp};
my $attr_dbi_include = $attr{DBI_INCLUDE};
if ( $^O eq 'VMS' ) {
$config_sitearch = VMS::Filespec::unixify($config_sitearch);
@@ -298,27 +299,27 @@
}
my $config_sitearch = $Config{sitearchexp};
my $attr_dbi_include = $attr{DBI_INCLUDE};
if ( $^O eq 'VMS' ) {
$config_sitearch = VMS::Filespec::unixify($config_sitearch);
if ( $attr{LINKTYPE} ) {
$LINKTYPE = $attr{LINKTYPE};
}
}
sub loadSybLibs {
- my $dir = shift;
+ my ($dir, $extensionRegexp) = @_;
my %libname = ();
opendir( SYBLIB, $dir )
or die "Unable to opendir $dir: $!\n";
foreach ( readdir(SYBLIB) ) {
next unless -f "$dir/$_";
- next unless /^lib(\S+)\.(so|a|sl)/;
+ next unless /^lib(\S+)\.$extensionRegexp/;
$libname{$1} = 1;
}
closedir(SYBLIB);
return %libname;