bucardo / dbdpg

Perl Postgres driver DBD::Pg aka dbdpg
48 stars 36 forks source link

Tests require output that is not present in "modern" initdb #53

Closed awilfox closed 5 years ago

awilfox commented 5 years ago
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Pg.bs blib/arch/auto/DBD/Pg/Pg.bs 644
PGINITDB="/usr/bin/initdb" PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_signature.t .... skipped: Set the environment variable TEST_SIGNATURE to enable this test
t/00basic.t ......... ok   
t/01connect.t ....... Please wait, creating new database (version 10.9) for testing
# 
# DBI                         Version 1.642
# DBD::Pg                     Version 3.8.1
# Perl                        Version 5.26.3
# OS                          linux
# PostgreSQL (compiled)       ?
# PostgreSQL (target)         ?
# PostgreSQL (reported)       ?
# Default port                ?
# DBI_DSN                     ?
# DBI_USER                    <not set>
# Test schema                 dbd_pg_testschema
# LANG                        C
# Adjusted:                   initdb
# Error was: initdb did not give a pg_ctl string: The files belonging to this database system will be owned by user "awilcox".
# This user must also own the server process.
# 
# The database cluster will be initialized with locale "C".
# The default text search configuration will be set to "english".
# 
# Data page checksums are disabled.
# 
# creating directory /usr/src/packages/user/perl-dbd-pg/src/DBD-Pg-3.8.1/dbdpg_test_database/data ... ok
# creating subdirectories ... ok
# selecting default max_connections ... 100
# selecting default shared_buffers ... 128MB
# selecting default timezone ... UTC
# selecting dynamic shared memory implementation ... posix
# creating configuration files ... ok
# running bootstrap script ... ok
# performing post-bootstrap initialization ... ok
# syncing data to disk ... ok
# 
# WARNING: enabling "trust" authentication for local connections
# You can change this by editing pg_hba.conf or using the option -A, or
# --auth-local and --auth-host, the next time you run initdb.
# 
# Success.
# 
# 
t/01connect.t ....... skipped: initdb did not give a pg_ctl string: The files belonging to this database system will be owned by user "awilcox".
t/01constants.t ..... ok     
t/02attribs.t ....... skipped: Connection to database failed, cannot continue testing
t/03dbmethod.t ...... skipped: Connection to database failed, cannot continue testing
t/03smethod.t ....... skipped: Connection to database failed, cannot continue testing
t/04misc.t .......... skipped: Connection to database failed, cannot continue testing
t/06bytea.t ......... skipped: Connection to database failed, cannot continue testing
t/07copy.t .......... skipped: Connection to database failed, cannot continue testing
t/08async.t ......... skipped: Connection to database failed, cannot continue testing
t/09arrays.t ........ skipped: Connection to database failed, cannot continue testing
t/12placeholders.t .. skipped: Connection to database failed, cannot continue testing
t/20savepoints.t .... skipped: Connection to database failed, cannot continue testing
t/30unicode.t ....... skipped: Connection to database failed, cannot continue testing
t/99cleanup.t ....... ok   
All tests successful.
Files=16, Tests=168,  5 wallclock secs ( 0.26 usr  0.06 sys +  8.14 cusr  1.02 csys =  9.48 CPU)
Result: PASS

If I comment out the elsif:

                #elsif ($info !~ /pg_ctl/) {
                #       $@ = "initdb did not give a pg_ctl string: $info";
                #       last GETHANDLE; ## Fail - bad output
                #}

then the tests work and pass:

"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Pg.bs blib/arch/auto/DBD/Pg/Pg.bs 644
PGINITDB="/usr/bin/initdb" PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00_signature.t .... skipped: Set the environment variable TEST_SIGNATURE to enable this test
t/00basic.t ......... ok   
t/01connect.t ....... Please wait, creating new database (version 10.9) for testing
t/01connect.t ....... 12/15 # 
# DBI                         Version 1.642
# DBD::Pg                     Version 3.8.1
# Perl                        Version 5.26.3
# OS                          linux
# PostgreSQL (compiled)       100009
# PostgreSQL (target)         100009
# PostgreSQL (reported)       PostgreSQL 10.9 on powerpc64-foxkit-linux-musl, compiled by gcc (Adelie 8.3.0) 8.3.0, 64-bit
# Default port                5432
# DBI_DSN                     dbi:Pg:db="postgres";port=5440;host=<pwd>/dbdpg_test_database/data/socket
# DBI_USER                    awilcox
# Test schema                 dbd_pg_testschema
# LANG                        C
# array_nulls                 on
# backslash_quote             safe_encoding
# client_encoding             UTF8
# server_encoding             UTF8
# standard_conforming_strings on
# Adjusted:                   initdb
t/01connect.t ....... ok     
t/01constants.t ..... ok     
t/02attribs.t ....... ok       
t/03dbmethod.t ...... ok       
t/03smethod.t ....... ok       
t/04misc.t .......... ok     
t/06bytea.t ......... ok     
t/07copy.t .......... ok     
t/08async.t ......... ok     
t/09arrays.t ........ ok       
t/12placeholders.t .. ok       
t/20savepoints.t .... ok   
t/30unicode.t ....... ok     
t/99cleanup.t ....... ok   
All tests successful.
Files=16, Tests=2445, 28 wallclock secs ( 0.75 usr  0.05 sys + 39.66 cusr  0.89 csys = 41.35 CPU)
Result: PASS
turnstep commented 5 years ago

Just a plain "Success."? That seems odd. Is this a modified initdb? Only occurrence of 'Success' in the source code is:

initdb.c:   printf(_("\nSuccess. You can now start the database server using:\n\n"
turnstep commented 5 years ago

Closing, as could not be duplicated, and some recent "initdb not found" errors have been fixed as of version 3.9.0