Ticket #33673: libpqxx-test.3.diff

File libpqxx-test.3.diff, 2.2 KB (added by ryandesign (Ryan Carsten Schmidt), 13 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 dbdir       ${workpath}/db
     80set dbname      test_libpqxx
     81set dbport      5455
     82test.run        yes
    6583test.cmd        make
    6684test.target     check
     85test.post_args  [portbuild::build_getjobsarg]
    6786
     87# PGDATABASE    (name of database; defaults to your user name)
     88# PGHOST        (database server; defaults to local machine)
     89# PGPORT        (PostgreSQL port to connect to; default is 5432)
     90# PGUSER        (your PostgreSQL user ID; defaults to your login name)
     91# PGPASSWORD    (your PostgreSQL password, if needed)
     92test.env        PGDATABASE=${dbname} \
     93                PGPORT=${dbport}
     94                #PGUSER
     95                #PGPASSWORD
     96
    6897pre-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
     98    system "${prefix}/lib/${server}/bin/initdb -D ${dbdir}"
     99    # "system" doesn't return for some reason, but exec does
     100    if {[catch {exec sudo -u ${macportsuser} ${prefix}/lib/${server}/bin/pg_ctl -w -D ${dbdir} -l ${dbdir}/logfile -o "-p ${dbport}" start} result]} {
     101        return -code error "could not start postgresql server"
     102    }
     103    system "${prefix}/lib/${server}/bin/createdb -p ${dbport} ${dbname}"
    83104}
    84105
    85106post-test {
    86     system "pg_ctl -w -D ${worksrcdir}/test_libpqxx stop -m fast"
    87     system "rm -rf ${worksrcdir}/test_libpqxx"
     107    system "${prefix}/lib/${server}/bin/pg_ctl -w -D ${dbdir} stop -m fast"
    88108}
    89