Re: DBD::Oracle 1.15 test failures (Oracle8i+HP-UX)

From: Marko Asplund (marko.asplund_at_kronodoc.fi)
Date: 03/20/04

  • Next message: Jared Still: "Re: Oracle 9.2.0.4 CBO bug"
    Date: Sat, 20 Mar 2004 19:16:13 +0200
    To:  dbi-users@perl.org
    
    
    

    Tim Bunce wrote:
    > On Mon, Feb 09, 2004 at 02:26:22PM +0200, Marko Asplund wrote:
    >
    >>On Fri, 2004-02-06 at 15:00, Tim Bunce wrote:
    >>
    >>>On Fri, Feb 06, 2004 at 11:33:54AM +0200, Marko Asplund wrote:
    >>>
    >>>>On Wed, 2004-02-04 at 21:08, Tim Bunce wrote:
    >>>>
    >>>>>Try running the DBD::Oracle v1.12 t/long.t using DBD::Oracle v1.15
    >>>>>(I don't know if it'll work or not, I don't think anyone's tried that)
    >>>>
    >>>>t/long.t from DBD::Oracle v1.12 runs without errors with v1.15 driver.
    >>>>tests number 195-198 fail in v1.15 t/long.t.
    >>>
    >>>So the tests have improved to catch this case. You could also try the
    >>>other way. Run the v1.15 t/long.t with DBD::Oracle v1.12 (you'll have to
    >>>disable/ignore some test for new features like the ora_lob_* functions).
    >>
    >>i disabled the LOB test block starting on line 278 in DBD::Oracle v1.15
    >>t/long.t. using DBD::Oracle v1.12 driver tests number 13, 106 and
    >>195-198 fail. with v1.15 driver tests 195-198 fail.
    >>
    >>
    >>>But whatever happens, I'm sure the problem is with Oracle.
    >>
    >>yes, i understand this but if possible it would be nice to not make the
    >>user worry whether a test failure is an indication of a real problem or
    >>not for example by skipping the test, outputting an informative message,
    >>by listing expected test failures by product version or some other way.
    >
    >
    > I agree. Patches welcome.

    i finally got around implementing this feature. now t/long.t tests
    number 195-198 are skipped on Oracle8i. this is implemented by writing
    client library version to a file in Makefile.PL and then loaded in
    t/long.t. i'm using Data::Dumper dumped hash because there might be more
    compile/runtime environment attributes that need to be passed e.g.
    server version. i'm not using mk.pm to not interfere with the
    configuration mechnism.

    best regards,

    t. aspa

    
    

    diff -ru DBD-Oracle-1.15.dist/Makefile.PL DBD-Oracle-1.15-3/Makefile.PL
    --- DBD-Oracle-1.15.dist/Makefile.PL 2004-01-28 01:45:15.000000000 +0200
    +++ DBD-Oracle-1.15-3/Makefile.PL 2004-03-20 19:05:11.000000000 +0200
    @@ -12,6 +12,7 @@
     use Config;
     use Cwd;
     use File::Find;
    +use IO::File;
     use strict;
     
     # This DBI must be installed before we can build a DBD.
    @@ -67,6 +68,7 @@
     my(@MK, %MK, $MK_TEXT, %MK_expanding); # parsed macros from Oracle's makefiles
     my %mk_target_deps;
     my %mk_target_rules;
    +my $oraenv = {};
     
     # Options (rarely needed)
     # to turn off an option prefix with 'no', ie 'perl Makefile.PL -nob'
    @@ -170,6 +172,7 @@
         ($inspdver{rdbms_ver} = $inspdver{RDBMS}) =~ s/^(\d+\.\d+)\.(\d+).*/${1}0$2/;
     
         print "Oracle version $inspdver{RDBMS} ($inspdver{rdbms_ver})\n" if $inspdver{RDBMS};
    + $oraenv->{'ORACLE_CLIENT_VERSION'}= $inspdver{rdbms_ver} || 0;
     
         if (!DBI::looks_like_number($inspdver{rdbms_ver}) || $inspdver{rdbms_ver} < 7 || $inspdver{rdbms_ver} > 10) {
             print qq{
    @@ -701,6 +704,17 @@
     print "\n";
     WriteMakefile( dbd_edit_mm_attribs(\%opts) );
     
    +# save settings
    +use Data::Dumper;
    +my $oraenvfn = "oraenv.pm";
    +my $oraenvfh = new IO::File(">oraenv.pm");
    +if($oraenvfh) {
    + $oraenvfh->print(Data::Dumper->Dump([$oraenv]));
    + $oraenvfh->close();
    +} else {
    + print STDERR "Warning: failed to open $oraenvfn for writing: $!\n";
    +}
    +
     check_security() unless $os eq 'VMS' or $os eq 'MSWin32' or $os =~ /cygwin/i;
     
     print "\n";
    diff -ru DBD-Oracle-1.15.dist/t/long.t DBD-Oracle-1.15-3/t/long.t
    --- DBD-Oracle-1.15.dist/t/long.t 2004-01-28 01:45:18.000000000 +0200
    +++ DBD-Oracle-1.15-3/t/long.t 2004-03-20 19:03:00.000000000 +0200
    @@ -54,6 +54,26 @@
         die "RETURNING array: $@";
     }
     
    +sub getoraenv {
    + use IO::File;
    + my $oraenvfn = "oraenv.pm";
    + my $oraenvfh = new IO::File($oraenvfn);
    + my $oraenv = {};
    + if($oraenvfh) {
    + my $fsize = -s $oraenvfn;
    + my ($oraenvbuf, $VAR1);
    + $oraenvfh->read($oraenvbuf, $fsize);
    + $oraenvfh->close();
    + eval "$oraenvbuf";
    + $oraenv = $VAR1;
    + }
    + return $oraenv;
    +}
    +
    +my $oraenv = getoraenv();
    +my $oracliversion = $oraenv->{ORACLE_CLIENT_VERSION} || 0;
    +
    +
     my @test_sets;
     push @test_sets, [ "BLOB", ORA_BLOB, 0 ] if ORA_OCI >= 8;
     push @test_sets, [ "CLOB", ORA_CLOB, 0 ] if ORA_OCI >= 8;
    @@ -152,13 +172,22 @@
     ok(0, $sth = $dbh->prepare("select * from $table order by idx"), 1);
     ok(0, $sth->execute, 1);
     ok(0, $tmp = $sth->fetchall_arrayref, 1);
    -ok(0, @$tmp == 4);
    -ok(0, $tmp->[0][1] eq substr($long_data0,0,$out_len),
    - cdif($tmp->[0][1], substr($long_data0,0,$out_len), "Len ".length($tmp->[0][1])) );
    -ok(0, $tmp->[1][1] eq substr($long_data1,0,$out_len),
    - cdif($tmp->[1][1], substr($long_data1,0,$out_len), "Len ".length($tmp->[1][1])) );
    -ok(0, $tmp->[2][1] eq substr($long_data2,0,$out_len),
    - cdif($tmp->[2][1], substr($long_data2,0,$out_len), "Len ".length($tmp->[2][1])) );
    +if($oracliversion>8.1 && $oracliversion<9) {
    + my $rs = "Tests skipped on Oracle8i";
    + skip($rs);
    + skip($rs);
    + skip($rs);
    + skip($rs);
    +} else {
    + ok(0, @$tmp == 4);
    + ok(0, $tmp->[0][1] eq substr($long_data0,0,$out_len),
    + cdif($tmp->[0][1], substr($long_data0,0,$out_len), "Len ".length($tmp->[0][1])) );
    + ok(0, $tmp->[1][1] eq substr($long_data1,0,$out_len),
    + cdif($tmp->[1][1], substr($long_data1,0,$out_len), "Len ".length($tmp->[1][1])) );
    + ok(0, $tmp->[2][1] eq substr($long_data2,0,$out_len),
    + cdif($tmp->[2][1], substr($long_data2,0,$out_len), "Len ".length($tmp->[2][1])) );
    +}
    +
     #use Data::Dumper; print Dumper($tmp->[3]);
     ok(0, !defined $tmp->[3][1], 1); # NULL # known bug in DBD::Oracle <= 1.13
     
    @@ -447,6 +476,11 @@
         return "(cdif error $l1/$l2/$i)";
     }
     
    +sub skip ($) {
    + my($msg) = @_;
    + $t++;
    + print "ok $t # skip $msg\n";
    +}
     
     sub ok ($$;$) {
         my($n, $ok, $warn) = @_;


  • Next message: Jared Still: "Re: Oracle 9.2.0.4 CBO bug"