简体   繁体   中英

Why SOCI regression tests for PostgreSQL fail on Windows?

I build and test SOCI 3.2 on Windows 10 with Visual Studio 2015, using this batch:

SET PREFIX=..\soci-3.2.3-install
SET POSTGRES_DIR=E:\PostgreSQL\9.5

cmake^
 -G "NMake Makefiles"^
 -DCMAKE_BUILD_TYPE=Release^
 -DCMAKE_INSTALL_PREFIX=%PREFIX%^
 -DSOCI_TESTS=ON^
 -DWITH_ODBC=OFF^
 -DWITH_POSTGRESQL=ON^
 -DPOSTGRESQL_INCLUDE_DIR="%POSTGRES_DIR%\include"^
 -DPOSTGRESQL_LIBRARIES="%POSTGRES_DIR%\lib\libpq.lib"^
 -DSOCI_POSTGRESQL_TEST_CONNSTR="host=localhost port=5432 dbname=postgres user=eagui"^
 ..\soci-3.2.3

nmake
nmake test

I also comment line 27 in soci-3.2.3\\core\\soci-platform.h before build, in order to avoid a macro redefinition error caused by one the VC headers. I make sure E:\\PostgreSQL\\9.5\\bin is added to PATH . The command prompt has admin privileges.

After running the batch, I get the following output from the test:

...
3/4 Test #3: soci_postgresql_test .............***Failed    1.37 sec
    Start 4: soci_postgresql_test_static
4/4 Test #4: soci_postgresql_test_static ......***Failed    0.17 sec

50% tests passed, 2 tests failed out of 4

Total Test time (real) =   1.63 sec

The following tests FAILED:
          3 - soci_postgresql_test (Failed)
          4 - soci_postgresql_test_static (Failed)
Errors while running CTest
NMAKE : fatal error U1077: 'echo' : return code '0x8'
Stop.

I have configured the PostgreSQL server to accept trust connections. The postgres database and eagui user exist in the server.

Any idea why tests do not pass for PostgreSQL and how to fix it?

At least one of the schemas set in the user's search path must exist in the database.

By default, the search path is set to look for a schema named after the user. This of course can be changed, so in order to see which schemas are looked for, the SHOW search_path; command can be run. For any new user that is created, the search path is set by default to "$user", public .

In this case the user eagui was specified in the connection string, but no eagui or public schema did exist in the postgres database. Creating one of these schemas make the tests pass.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM