Ticket #33673: libpqxx-test.2.diff

File libpqxx-test.2.diff, 2.1 KB (added by ryandesign (Ryan Carsten Schmidt), 12 years ago)
  • Portfile

     
    6176# http://pqxx.org/development/libpqxx/browser/trunk/README?rev=latest
    6277# http://pqxx.org/development/libpqxx/wiki/TestDocs
    6378
    64 test.run        no
     79set testdb      test_libpqxx
     80set testport    5455
     81test.run        yes
    6582test.cmd        make
    6683test.target     check
    6784
     85# PGDATABASE    (name of database; defaults to your user name)
     86# PGHOST        (database server; defaults to local machine)
     87# PGPORT        (PostgreSQL port to connect to; default is 5432)
     88# PGUSER        (your PostgreSQL user ID; defaults to your login name)
     89# PGPASSWORD    (your PostgreSQL password, if needed)
     90test.env        PGDATABASE=${testdb} \
     91                PGPORT=${testport}
     92                #PGUSER
     93                #PGPASSWORD
     94
    6895pre-test {
    69     system "initdb -D ${worksrcdir}/test_libpqxx"
    70     system "pg_ctl -w -D ${worksrcdir}/test_libpqxx -l ${worksrcdir}/test_libpqxx/logfile -o \"-p 5455\" start"
    71     # test for existence of ${worksrcdir}/test_libpqxx/postmaster.pid to indicate success
    72 
    73     # PGDATABASE    (name of database; defaults to your user name)
    74     # PGHOST        (database server; defaults to local machine)
    75     # PGPORT        (PostgreSQL port to connect to; default is 5432)
    76     # PGUSER        (your PostgreSQL user ID; defaults to your login name)
    77     # PGPASSWORD    (your PostgreSQL password, if needed)
    78     test.env-append \
    79         PGDATABASE=${worksrcdir}/test_libpqxx \
    80         PGPORT=5455
    81         #PGUSER
    82         #PGPASSWORD
     96    system -W ${worksrcpath} "${prefix}/lib/${server}/bin/initdb -D ${testdb}"
     97    # "system" doesn't return for some reason, but exec does
     98    if {[catch {exec sudo -u ${macportsuser} ${prefix}/lib/${server}/bin/pg_ctl -w -D ${worksrcpath}/${testdb} -l ${worksrcpath}/${testdb}/logfile -o "-p ${testport}" start} result]} {
     99        return -code error "could not start postgresql server: ${result}"
     100    }
    83101}
    84102
    85103post-test {
    86     system "pg_ctl -w -D ${worksrcdir}/test_libpqxx stop -m fast"
    87     system "rm -rf ${worksrcdir}/test_libpqxx"
     104    system -W ${worksrcpath} "${prefix}/lib/${server}/bin/pg_ctl -w -D ${testdb} stop -m fast"
    88105}
    89