File: 00-warning.t

package info (click to toggle)
librose-db-perl 0.786-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 840 kB
  • sloc: perl: 12,269; makefile: 9
file content (107 lines) | stat: -rwxr-xr-x 3,309 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/perl

use strict;

sub nvl { defined $ENV{$_[0]} ? $ENV{$_[0]} : $_[1] }

print STDERR<<"EOF";

##
## WARNING: Almost all the tests in this module distribution need to connect
## to a database in order to run.  The tests need full privileges on this
## database: the ability to create and drop tables, insert, update, and delete
## rows, create schemas, sequences, functions, triggers, the works.
##
## By default, the tests will try to connect to the database named "test"
## running on "localhost" using the default superuser username for each
## database type and an empty password.
##
## If you have setup your database in a secure manner, these connection
## attempts will fail, and the tests will be skipped.  If you want to override
## these values, set the following environment variables before running tests.
## (The current values are shown in parentheses.)
##
## PostgreSQL:
##
##     RDBO_PG_DSN        (@{[ nvl('RDBO_PG_DSN', 'dbi:Pg:dbname=test;host=localhost') ]})
##     RDBO_PG_USER       (@{[ nvl('RDBO_PG_USER', 'postgres') ]})
##     RDBO_PG_PASS       (@{[ nvl('RDBO_PG_PASS', '<none>') ]})
##
## MySQL:
## 
##     RDBO_MYSQL_DSN     (@{[ nvl('RDBO_MYSQL_DSN', 'dbi:mysql:database=test;host=localhost') ]})
##     RDBO_MYSQL_USER    (@{[ nvl('RDBO_MYSQL_USER', 'root') ]})
##     RDBO_MYSQL_PASS    (@{[ nvl('RDBO_MYSQL_PASS', '<none>') ]})
##
## MariaDB:
## 
##     RDBO_MARIADB_DSN     (@{[ nvl('RDBO_MARIADB_DSN', 'dbi:mysql:database=test;host=localhost') ]})
##     RDBO_MARIADB_USER    (@{[ nvl('RDBO_MARIADB_USER', 'test') ]})
##     RDBO_MARIADB_PASS    (@{[ nvl('RDBO_MARIADB_PASS', '<none>') ]})
##
## Oracle:
##
##     RDBO_ORACLE_DSN    (@{[ nvl('RDBO_ORACLE_DSN', 'dbi:Oracle:dbname=test') ]})
##     RDBO_ORACLE_USER   (@{[ nvl('RDBO_ORACLE_USER', '<none>') ]})
##     RDBO_ORACLE_PASS   (@{[ nvl('RDBO_ORACLE_PASS', '<none>') ]})
##
## Informix:
##
##     RDBO_INFORMIX_DSN  (@{[ nvl('RDBO_INFORMIX_DSN', 'dbi:Informix:test@test') ]})
##     RDBO_INFORMIX_USER (@{[ nvl('RDBO_INFORMIX_USER', '<none>') ]})
##     RDBO_INFORMIX_PASS (@{[ nvl('RDBO_INFORMIX_PASS', '<none>') ]})
##
## SQLite: To disable the SQLite tests, set this environment varible
##
##     RDBO_NO_SQLITE (@{[ nvl('RDBO_NO_SQLITE', '<undef>') ]})
##
## Press return to continue (or wait 60 seconds)
EOF

eval { require DBD::SQLite };

(my $version = $DBD::SQLite::VERSION || 0) =~ s/_//g;

if(!$@ && ($version < 1.11 || ($version >= 1.13 && $version < 1.1902)))
{
print STDERR<<"EOF";

***
*** WARNING: DBD::SQLite version 1.13 detected.  This version has some
*** serious bugs that prevent the test suite from working correctly.
*** In particular:
***
***     http://rt.cpan.org/Public/Bug/Display.html?id=21472
***
*** The SQLite tests will be skipped.  Please install DBD::SQLite 1.12
*** or a version that fixes the bugs in 1.13.
***
*** Press return to continue (or wait 60 seconds)
EOF
}

unless($ENV{'AUTOMATED_TESTING'} || $ENV{'PERL_MM_USE_DEFAULT'})
{
  my %old;

  $old{'ALRM'} = $SIG{'ALRM'} || 'DEFAULT';

  eval
  {
    # Localize so I only have to restore in my catch block
    local $SIG{'ALRM'} = sub { die 'alarm' };
    alarm(60);
    my $res = <STDIN>;
    alarm(0);
  };

  if($@ =~ /alarm/)
  {
    $SIG{'ALRM'} = $old{'ALRM'};
  }
}

print "1..1\n",
      "ok 1\n";

1;