[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3528] trunk



Revision: 3528
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3528&view=rev
Author:   einhverfr
Date:     2011-07-15 23:24:29 +0000 (Fri, 15 Jul 2011)

Log Message:
-----------
Correcting Database.pm error that gave erroneous return codes to the test rig, with test safety ramifications

Modified Paths:
--------------
    trunk/LedgerSMB/Database.pm
    trunk/t/40-dbsetup.t

Modified: trunk/LedgerSMB/Database.pm
===================================================================
--- trunk/LedgerSMB/Database.pm	2011-07-15 22:40:14 UTC (rev 3527)
+++ trunk/LedgerSMB/Database.pm	2011-07-15 23:24:29 UTC (rev 3528)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-=head1 NAMR
+=head1 NAME
 
 LedgerSMB::Database
 
@@ -80,6 +80,9 @@
     my ($self) = @_;
     
     my $rc = system("createdb -E UTF8 > $temp/dblog");
+    if ($rc) {
+        return $rc;
+    }
 
      my @contrib_scripts = qw(pg_trgm tsearch2 tablefunc);
 
@@ -88,10 +91,10 @@
          $rc2=system("psql -f $ENV{PG_CONTRIB_DIR}/$contrib.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
          $rc ||= $rc2
      }
-     if (!system("psql -f $self->{source_dir}sql/Pg-database.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr"
-     )){
-         $rc = 1;
-     }
+     my $rc2 = system("psql -f $self->{source_dir}sql/Pg-database.sql >> $temp/dblog_stdout 2>>$temp/dblog_stderr");
+     
+     $rc ||= $rc2;
+
      # TODO Add logging of errors/notices
 
      return $rc;

Modified: trunk/t/40-dbsetup.t
===================================================================
--- trunk/t/40-dbsetup.t	2011-07-15 22:40:14 UTC (rev 3527)
+++ trunk/t/40-dbsetup.t	2011-07-15 23:24:29 UTC (rev 3528)
@@ -39,8 +39,9 @@
 });
 
 # Manual tests
-ok($db->create, 'Database Created') 
-  || BAIL_OUT('Database could not be created!');
+my $rc = $db->create;
+ok(!$rc, 'Database Created') 
+  || BAIL_OUT('Database could not be created! ' . $rc);
 
 ok($db->load_modules('LOADORDER'), 'Modules loaded');
 if (!$ENV{LSMB_INSTALL_DB}){


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.