mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Add explicit -DTEST_MYSQL
Since the setup is a bit more manual and not as self-contained, so most probably don't want to test it locally.
This commit is contained in:
parent
04594397ca
commit
f464f148ac
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
|
@ -130,7 +130,7 @@ jobs:
|
|||
run: |
|
||||
mkdir fancy
|
||||
cd fancy
|
||||
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DANTIBOT=ON -DMYSQL=ON -DWEBSOCKETS=ON -DMYSQL=ON ..
|
||||
${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DANTIBOT=ON -DTEST_MYSQL=ON -DWEBSOCKETS=ON ..
|
||||
${{ matrix.cmake-path }}cmake --build . --config RelWithDebInfo --target everything ${{ matrix.build-args }}
|
||||
- name: Test fancy
|
||||
if: matrix.fancy
|
||||
|
|
|
@ -101,6 +101,7 @@ endif()
|
|||
|
||||
option(WEBSOCKETS "Enable websockets support" OFF)
|
||||
option(MYSQL "Enable mysql support" OFF)
|
||||
option(TEST_MYSQL "Test mysql support in unit tests (also sets -DMYSQL=ON)" OFF)
|
||||
option(AUTOUPDATE "Enable the autoupdater" OFF)
|
||||
option(INFORM_UPDATE "Inform about available updates" ON)
|
||||
option(VIDEORECORDER "Enable video recording support via FFmpeg" OFF)
|
||||
|
@ -117,6 +118,10 @@ option(DISCORD_DYNAMIC "Enable discovering Discord rich presence libraries at ru
|
|||
option(PREFER_BUNDLED_LIBS "Prefer bundled libraries over system libraries" ${AUTO_DEPENDENCIES_DEFAULT})
|
||||
option(DEV "Don't generate stuff necessary for packaging" OFF)
|
||||
|
||||
if(TEST_MYSQL)
|
||||
set(MYSQL ON)
|
||||
endif()
|
||||
|
||||
# Set version if not explicitly set
|
||||
if(NOT VERSION)
|
||||
set(VERSION ${PROJECT_VERSION})
|
||||
|
@ -2819,6 +2824,9 @@ foreach(target ${TARGETS_OWN})
|
|||
target_compile_definitions(${target} PRIVATE CONF_MYSQL)
|
||||
target_include_directories(${target} PRIVATE ${MYSQL_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(TEST_MYSQL)
|
||||
target_compile_definitions(${target} PRIVATE CONF_TEST_MYSQL)
|
||||
endif()
|
||||
if(AUTOUPDATE AND NOT STEAM)
|
||||
target_compile_definitions(${target} PRIVATE CONF_AUTOUPDATE)
|
||||
endif()
|
||||
|
|
10
README.md
10
README.md
|
@ -72,6 +72,16 @@ Whether to enable MySQL/MariaDB support for server. Requires at least MySQL 8.0
|
|||
|
||||
Note that the bundled MySQL libraries might not work properly on your system. If you run into connection problems with the MySQL server, for example that it connects as root while you chose another user, make sure to install your system libraries for the MySQL client. Make sure that the CMake configuration summary says that it found MySQL libs that were not bundled (no "using bundled libs").
|
||||
|
||||
* **-DTEST_MYSQL=[ON|OFF]** <br>
|
||||
Whether to test MySQL/MariaDB support in GTest based tests. Note that this requires a running MySQL/MariaDB database on localhost with this setup:
|
||||
|
||||
```
|
||||
CREATE DATABASE ddnet;
|
||||
CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
|
||||
GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
* **-DAUTOUPDATE=[ON|OFF]** <br>
|
||||
Whether to enable the autoupdater. Packagers may want to disable this for their packages. Default value is ON for Windows and Linux.
|
||||
|
||||
|
|
|
@ -7,13 +7,7 @@
|
|||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#if defined(CONF_MYSQL)
|
||||
|
||||
// For MySQL this setup is required on localhost:
|
||||
// CREATE DATABASE ddnet;
|
||||
// CREATE USER 'ddnet'@'localhost' IDENTIFIED BY 'thebestpassword';
|
||||
// GRANT ALL PRIVILEGES ON ddnet.* TO 'ddnet'@'localhost';
|
||||
// FLUSH PRIVILEGES;
|
||||
#if defined(CONF_TEST_MYSQL)
|
||||
int DummyMysqlInit = (MysqlInit(), 1);
|
||||
#endif
|
||||
|
||||
|
@ -463,7 +457,7 @@ TEST_P(RandomMap, UnfinishedDoesntExist)
|
|||
auto testValues
|
||||
{
|
||||
testing::Values(CreateSqliteConnection(":memory:", true)
|
||||
#if defined(CONF_MYSQL)
|
||||
#if defined(CONF_TEST_MYSQL)
|
||||
,
|
||||
CreateMysqlConnection("ddnet", "record", "ddnet", "thebestpassword", "localhost", 3306, true)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue