~ubuntu-branches/ubuntu/wily/libdbd-csv-perl/wily

« back to all changes in this revision

Viewing changes to t/lib.pl

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2013-08-09 16:04:59 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20130809160459-zhwiejm1ki0we77o
Tags: 0.4100-1
* New upstream release:
  Fix "FTBFS: tests failed" <explain what you changed and why>
  (Closes: #713236)
* Update versioned (build-) dependencies.
* Update years of packaging copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
use File::Spec;
11
11
 
12
 
my $test_dir  = File::Spec->catdir (File::Spec->curdir (), "output");
13
 
my $test_dsn  = $ENV{DBI_DSN}  || "DBI:CSV:f_dir=$test_dir";
 
12
my $testname  = "output$$";
 
13
my $base_dir  = File::Spec->rel2abs (File::Spec->curdir ());
 
14
my $test_dir  = File::Spec->rel2abs ($testname);
 
15
my $test_dsn  = $ENV{DBI_DSN}  || "DBI:CSV:f_dir=$testname";
14
16
my $test_user = $ENV{DBI_USER} || "";
15
17
my $test_pass = $ENV{DBI_PASS} || "";
16
18
 
17
 
# Start each test clean
18
 
unlink glob "$test_dir/*";
19
 
 
20
19
sub COL_NULLABLE () { 1 }
21
20
sub COL_KEY      () { 2 }
22
21
 
92
91
    @tables;
93
92
    } # ListTables
94
93
 
95
 
-d "output"or mkdir "output", 0755;
 
94
sub DbCleanup
 
95
{
 
96
    chdir $base_dir;
 
97
    -d $testname or return;
 
98
    chdir $testname or BAIL_OUT ("Cleanup failed");
 
99
    unlink glob "*";
 
100
    chdir $base_dir;
 
101
    rmdir $testname;
 
102
    } # DbCleanup
 
103
 
 
104
mkdir $testname, 0755;
 
105
END { DbCleanup (); }
96
106
 
97
107
# This functions generates a list of possible DSN's aka
98
108
# databases and returns a possible table name for a new
162
172
 
163
173
sub DbDir
164
174
{
165
 
    @_ and $test_dir = File::Spec->catdir (File::Spec->curdir (), shift);
 
175
    @_ and $test_dir = File::Spec->catdir ($base_dir, shift);
166
176
    $test_dir;
167
177
    } # DbDir
168
178