Opened 13 years ago

Closed 5 years ago

#33673 closed defect (fixed)

libpqxx: tests don't work

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.0.4
Keywords: haspatch Cc:
Port: libpqxx

Description

"sudo port test libpqxx" doesn't work. It says:

DEBUG: Executing proc-pre-org.macports.test-test-0
sh: initdb: command not found
shell command "initdb -D libpqxx-4.0/test_libpqxx" returned error 127

This is not surprising since "initdb" is a command provided by the postgresql ports, and they're never installed anywhere in $PATH. The fix is to call these programs by their correct absolute paths; the attached patch (which should be applied after updating the port to 4.0 using the patches in #33671) fixes this, but then we run into this next error:

DEBUG: Executing proc-pre-org.macports.test-test-0
The files belonging to this database system will be owned by user "macports".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

creating directory libpqxx-4.0/test_libpqxx ... initdb: could not create directory "libpqxx-4.0": Permission denied
shell command "/opt/local/lib/postgresql91/bin/initdb -D libpqxx-4.0/test_libpqxx" returned error 1

I don't know postgresql or libpqxx so I'm not sure what needs to be done to fix this.

Attachments (3)

libpqxx-test.diff (948 bytes) - added by ryandesign (Ryan Carsten Schmidt) 13 years ago.
libpqxx-test.2.diff (2.1 KB) - added by ryandesign (Ryan Carsten Schmidt) 13 years ago.
libpqxx-test.3.diff (2.2 KB) - added by ryandesign (Ryan Carsten Schmidt) 13 years ago.

Download all attachments as: .zip

Change History (9)

Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: libpqxx-test.diff added

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Looking at this further, I see the tests probably never worked since the portfile says "test.run no".

I think the portfile was making assumptions about the current working directory. Fixing that and a few other details gets us much further, to the postgresql server actually starting and the tests being run. But they all fail with:

Exception: FATAL:  database "test_libpqxx" does not exist

I haven't read the documentation so I don't know what's expected to happen, but what I observe to happen is:

  1. "initdb" creates a directory in which postgresql can store databases, and creates the minimal system databases required
  2. "pg_ctl start" starts postgresql pointed at that directory for storage
  3. "make" check runs tests against a particular database which it expects to already exist

So it seems like we need a step up there between 2 and 3 to actually create that database.

Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: libpqxx-test.2.diff added

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Yes, running createdb to create the database first is looking very promising. But it fails later with:

ld: duplicate symbol __ZTIN12_GLOBAL__N_116deliberate_errorE$non_lazy_pointer in .libs/runner and .libs/runner
collect2: ld returned 1 exit status

This is discussed on their mailing list and is apparently a compiler bug, which is super since I doubt Apple will release any new versions of gcc for us. Someone could test whether we're ok using llvm-gcc-4.2 or clang, and if so, maybe we don't care about gcc anymore either.

I've also enabled running the tests in parallel, since the README specifically mentions doing that.

Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: libpqxx-test.3.diff added

comment:3 in reply to:  2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

ld: duplicate symbol __ZTIN12_GLOBAL__N_116deliberate_errorE$non_lazy_pointer in .libs/runner and .libs/runner

I get the same problem building libpqxx with the compiler from the clang-3.0 port.

comment:4 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Committed in r91295, though as I say the tests don't complete for me. If the tests do run successfully for anybody else, or if you know what to do to fix it, please let us know here.

comment:5 Changed 10 years ago by mf2k (Frank Schima)

Owner: changed from dweber@… to macports-tickets@…

dweber has retired. See #43834.

comment:6 Changed 5 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

In 234eba5b62738e6ad5efec9b208847b3b3149ed9/macports-ports (master):

libpqxx: update to 6.4.5

Requires at least PostgreSQL 9.1 and a C++11 compiler.

Fixes: #33673
Fixes: #58620

Note: See TracTickets for help on using tickets.