Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d34bbfa
Add PostgreSQL support to TAF
lukas7811 Jun 22, 2026
c6134e3
Fix PostgreSQL setup script for EL10 AppStream and sysbench build
lukas7811 Jul 14, 2026
a88203e
setup_almalinux10.sh: upgrade to PostgreSQL 18.4, fix missing postgre…
lukas7811 Jul 15, 2026
62d135c
Add postgresql_default.conf as the new default db_config_file; PG18 t…
lukas7811 Jul 15, 2026
9e29a9f
docs: update test_taf_postgresql.py docstring for PostgreSQL 18
lukas7811 Jul 15, 2026
dba4d6d
Remove accidentally added copyright information and leave it to jeb
lukas7811 Jul 15, 2026
be7266e
Align PostgreSQL sysbench config with MariaDB, harden sysbench build …
lukas7811 Jul 17, 2026
9eff594
Add --debug-print-config: dump fully resolved taf.pl configuration
lukas7811 Jul 19, 2026
0f1d2e1
Fix ValidateTargetWithSuite comparing normalized vs. raw db_driver
lukas7811 Jul 19, 2026
b2ecf49
sysbench_lua.properties (mariadb): drop the 4-thread step, align swee…
lukas7811 Jul 21, 2026
57f490c
sysbench-lua.pm: honor db_clients_use_unix_socket for the pgsql drive…
lukas7811 Jul 21, 2026
b46b0b1
Add mariadb_default.cnf: stock-defaults reference profile, mirrors po…
lukas7811 Jul 21, 2026
73f34b7
mariadb.pm: handle running as root, mirroring postgres.pm's _os_prefix()
lukas7811 Jul 21, 2026
ca7edfc
mariadb.pm: chown tmpdir recursively, not just the directory itself
lukas7811 Jul 21, 2026
b3e30da
mariadb.pm: pre-create+chown the pidfile before forking, fixing a roo…
lukas7811 Jul 21, 2026
6b2e103
mariadb_default.cnf: add required [mysqld] section header
lukas7811 Jul 21, 2026
8cd7add
Fix PostgreSQL unix-socket path, cross-engine sysbench driver detecti…
lukas7811 Jul 27, 2026
1bcabb3
Added credits to me and Virtuozzo to the postgres.pm module.
lukas7811 Jul 28, 2026
07ead58
Merge remote-tracking branch 'origin/main' into pr/PostgreSQL-in-TAF
lukas7811 Aug 17, 2026
1d5f4a2
sysbench-lua.pm: fix missing path separator in pgsql socket-dir fallback
lukas7811 Aug 17, 2026
a2d70ef
test_taf_postgresql.py: simplify pg_ctl stop cleanup for non-root Pos…
lukas7811 Aug 17, 2026
8586b44
postgres.pm: align root-handling with mariadb.pm's existing approach
lukas7811 Aug 17, 2026
8892adf
postgres.pm, mariadb.pm: fix runuser failing when cwd is under /root
lukas7811 Aug 17, 2026
9132902
sysbench-lua: enable PostgreSQL driver build on Linux
lukas7811 Aug 18, 2026
ed31384
Executor.pm: add missing Version header; remove stray duplicate postg…
lukas7811 Aug 18, 2026
bb380c1
Executor.pm: add missing Version header
lukas7811 Aug 18, 2026
f58ff02
taf.pl: move --debug-print-config dump into TAF::Logging, write to a …
lukas7811 Aug 18, 2026
b35b96d
database_config_files/mysql: add mysql_default.cnf reference profile
lukas7811 Aug 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 220 additions & 94 deletions client_source/sysbench-lua/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
#############################################################################
# CMakeLists.txt
#
# Last Modified: March 2026
#
# This file is part of the Test Automation Framework (TAF).
# Copyright (c) 2025-2026 MariaDB Foundation and Jonathan "jeb" Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 or later of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335
#
# Licensed under the GNU General Public License, version 2 or later (GPLv2+).
# See https://www.gnu.org/licenses/ for details.
#
# PURPOSE:
# Provide a deterministic, contributor-proof CMake build system for
# sysbench-lua within the Test Automation Framework (TAF). This includes
# structured detection of headers, libraries, and capabilities across
# multiple database drivers (MySQL, PostgreSQL, Oracle, Null), along with
# stable configuration generation and predictable build behavior.
#
# CONTEXT:
# This updated version incorporates PostgreSQL driver support as part of
# Virtuozzo's push toward PG adoption within TAF. Special thanks to Lukas
# Oliva (Virtuozzo) for implementation and integration work on the PG
# driver, enabling full multi-DB testing within sysbench-lua.
#
# ARCHITECTURAL ROLE:
# - Acts as the top-level build definition for sysbench-lua.
# - Ensures deterministic detection of MySQL, PGSQL, Oracle, and Null
# drivers, including header and library resolution.
# - Replicates the original autotools config.h behavior using modern CMake.
# - Provides stable integration of third-party dependencies (LuaJIT, CK).
# - Normalizes cross-platform behavior across Linux and macOS.
#
# WHAT THIS FILE DOES NOT DO:
# - Does not implement driver logic; it only builds and links drivers.
# - Does not guess paths or silently fall back to system defaults.
# - Does not alter semantics of underlying driver modules.
# - Does not perform runtime validation; all checks are compile-time only.
#
# CONTRACT:
# - Must produce a deterministic sysbench-lua binary.
# - Must expose correct driver selection based on WITH_* flags.
# - Must generate a correct config.h reflecting system capabilities.
# - Must maintain backward compatibility with existing TAF workflows.
#
# GUARANTEES:
# - Stable, predictable builds across environments.
# - Contributor-proof behavior through explicit detection logic.
# - Consistent naming, error handling, and configuration semantics.
#
# NOTES:
# - This file is intentionally verbose and heavily documented to ensure
# clarity for contributors and maintainers.
# - Any change to driver detection, config.h generation, or third-party
# integration must be reflected in this header and in TAF documentation.
#############################################################################

###################################################
# CMake initialization and global project settings #
###################################################
cmake_minimum_required(VERSION 2.6)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
Expand All @@ -9,18 +81,27 @@ endif(WIN32)

project(sysbench-lua)

option( WITH_MYSQL "with-mysql" OFF )
set ( PACKAGE \"sysbench\" )
set ( PACKAGE_NAME \"sysbench\" )
set ( PACKAGE_TARNAME \"sysbench\" )
set ( PACKAGE_STRING \"sysbench 1.1.0\" )
set ( PACKAGE_VERSION \"1.1.0\" )
set (PACKAGE_URL \"https://github.com/akopytov/sysbench\")
set ( VERSION \"1.1.0\" )
set ( SB_GIT_SHA \"-2e6b7d5\" )
set ( SB_WITH_LUAJIT \"bundled\")
set ( SB_WITH_CK \"bundled\")

message("=== DEBUG: RAW CMAKE VARIABLES ===")
message("CMAKE_ARGS RAW = ${CMAKE_ARGS}")
message("CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
message("CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
message("=== END DEBUG ===")


set ( PACKAGE \"sysbench\" )
set ( PACKAGE_NAME \"sysbench\" )
set ( PACKAGE_TARNAME \"sysbench\" )
set ( PACKAGE_STRING \"sysbench 1.1.0\" )
set ( PACKAGE_VERSION \"1.1.0\" )
set (PACKAGE_URL \"https://github.com/akopytov/sysbench\")
set ( VERSION \"1.1.0\" )
set ( SB_GIT_SHA \"-2e6b7d5\" )
set ( SB_WITH_LUAJIT \"bundled\")
set ( SB_WITH_CK \"bundled\")

###################################################
# Third-party dependencies (LuaJIT, CK) #
###################################################
message("Add thirparty luajit")
add_subdirectory(third_party/luajit/luajit)
add_library(luajit STATIC IMPORTED)
Expand All @@ -37,31 +118,46 @@ set_property(TARGET lib_ck PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DI

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third_party/concurrency_kit/ck ${CMAKE_CURRENT_SOURCE_DIR}/third_party/concurrency_kit/ck/src ${CMAKE_CURRENT_SOURCE_DIR}/third_party/concurrency_kit/ck/include)


if(WITH_MYSQL)
if ("${MYSQLH_PATH}" STREQUAL "")
if(DEFINED ENV{INC})
find_path(MYSQLH_PATH mysql.h ENV INC)
message("mysql.h directory = ${MYSQLH_PATH}")
else(DEFINED ENV{INC})
message( FATAL_ERROR "MYSQLH_PATH not set, and Env var INC not set, CMake will exit." )
endif(DEFINED ENV{INC})
endif("${MYSQLH_PATH}" STREQUAL "")
endif(WITH_MYSQL)
####################################################
# Deterministic MySQL header and library detection #
####################################################
if(WITH_MYSQL)
if ("${MYSQLH_PATH}" STREQUAL "")
if(DEFINED ENV{INC})
find_path(MYSQLH_PATH mysql.h ENV INC)
message("mysql.h directory = ${MYSQLH_PATH}")
else(DEFINED ENV{INC})
message( FATAL_ERROR "MYSQLH_PATH not set, and Env var INC not set, CMake will exit." )
endif(DEFINED ENV{INC})
endif("${MYSQLH_PATH}" STREQUAL "")
endif(WITH_MYSQL)
# Use environment variables provided by ClientCmakeBuild
if(NOT DEFINED MYSQLH_PATH)
if(DEFINED ENV{INC})
set(MYSQLH_PATH "$ENV{INC}")
message("mysql.h directory = ${MYSQLH_PATH}")
else()
message(FATAL_ERROR "MYSQLH_PATH not set and ENV{INC} missing")
endif()
endif()

if(NOT DEFINED LIBMYSQL_LIB)
if(DEFINED ENV{LIB})
if(APPLE)
find_file(LIBMYSQL_LIB libmysqlclient.dylib ENV LIB)
else()
find_file(LIBMYSQL_LIB libmysqlclient.so ENV LIB)
endif()
else()
message(FATAL_ERROR "LIBMYSQL_LIB not set and ENV{LIB} missing")
endif()
endif()

message("mysqlclient = ${LIBMYSQL_LIB}")

if(MYSQLH_PATH AND LIBMYSQL_LIB)
set(USE_MYSQL 1)
message("USE_MYSQL = ${USE_MYSQL}")
endif()
endif()

###################################################
# Core UNIX configuration checks #
###################################################
if (UNIX)
# Initial Linux build for sysbench against MySQL & NULL
# TODO: Add Oracle & PgSQL
# Core UNIX configuration checks (headers, functions, types)
# Required for all drivers: MySQL, PGSQL, Oracle, Null
# Replicates original autotools implementation wrt config.h
include( CheckLibraryExists )
include( CheckIncludeFiles )
Expand Down Expand Up @@ -124,25 +220,7 @@ if (UNIX)
set( CMAKE_REQUIRED_INCLUDES math.h )
set( CMAKE_REQUIRED_LIBRARIES m )

if(WITH_MYSQL)
if ("${LIBMYSQL_LIB}" STREQUAL "")
if(DEFINED ENV{LIB})
if(APPLE)
find_file(LIBMYSQL_LIB libmysqlclient.dylib ENV LIB)
else(APPLE)
find_file(LIBMYSQL_LIB libmysqlclient.so ENV LIB)
endif(APPLE)
else(DEFINED ENV{INC})
message( FATAL_ERROR "LIBMYSQL_LIB not set, and Env var LIB not set, CMake will exit." )
endif(DEFINED ENV{LIB})
endif("${LIBMYSQL_LIB}" STREQUAL "")
message("mysqlclient = ${LIBMYSQL_LIB}")
if(MYSQLH_PATH AND LIBMYSQL_LIB)
set(USE_MYSQL 1)
message("USE_MYSQL = ${USE_MYSQL}")
endif(MYSQLH_PATH AND LIBMYSQL_LIB)
endif(WITH_MYSQL)
if(WITH_NULL)
if(WITH_NULL)
set(USE_NULL 1)
endif(WITH_NULL)
find_package (Threads)
Expand Down Expand Up @@ -296,53 +374,99 @@ target_link_libraries (sysbench luajit)
target_link_libraries (sysbench ${CMAKE_DL_LIBS})
target_link_libraries (sysbench lib_ck)

###################################################
# Driver selection (MySQL, PGSQL, Oracle, Null) #
# Drivers are disabled unless explicitly enabled. #
###################################################
set(USE_MYSQL 0)
set(USE_PGSQL 0)
set(USE_ORACLE 0)
set(USE_NULL 0)

if(WITH_MYSQL)
set(USE_MYSQL 1)
endif()

if(WITH_PGSQL)
set(USE_PGSQL 1)
endif()

if(WITH_ORACLE)
set(USE_ORACLE 1)
endif()

if(WITH_NULL)
set(USE_NULL 1)
endif()

##########################
# Driver selection debug #
##########################
message("=== DRIVER SELECTION DEBUG ===")
message("WITH_MYSQL = ${WITH_MYSQL}")
message("WITH_PGSQL = ${WITH_PGSQL}")
message("WITH_ORACLE = ${WITH_ORACLE}")
message("WITH_NULL = ${WITH_NULL}")
message("USE_MYSQL = ${USE_MYSQL}")
message("USE_PGSQL = ${USE_PGSQL}")
message("USE_ORACLE = ${USE_ORACLE}")
message("USE_NULL = ${USE_NULL}")
message("ENV{INC} = $ENV{INC}")
message("ENV{LIB} = $ENV{LIB}")
message("MYSQLH_PATH = ${MYSQLH_PATH}")
message("PGSQLH_PATH = ${PGSQLH_PATH}")
message("LIBMYSQL_LIB = ${LIBMYSQL_LIB}")
message("LIBPGSQL_LIB = ${LIBPGSQL_LIB}")
message("=== END DRIVER DEBUG ===")

#####################
# Null driver block #
#####################
if(USE_NULL)
message("Adding null db driver")
add_subdirectory(src/drivers/nulldb)
target_link_libraries (sysbench sbnull)
message("Add done")
endif(USE_NULL)
message("Adding null db driver")
add_subdirectory(src/drivers/nulldb)
target_link_libraries(sysbench sbnull)
endif()

######################
# MySQL driver block #
######################
if(USE_MYSQL)
message("Adding MySQL db driver")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MYSQL")
include_directories(${MYSQLH_PATH} ${CMAKE_SOURCE_DIR} )
add_subdirectory(src/drivers/mysql)
target_link_libraries (sysbench sbmysql)
if(HAVE_LIBAIO)
target_link_libraries (sysbench ${LIBMYSQL_LIB} ${CMAKE_THREAD_LIBS_INIT} m aio)
else()
target_link_libraries (sysbench ${LIBMYSQL_LIB} ${CMAKE_THREAD_LIBS_INIT} m)
endif()
message("Add done")
endif(USE_MYSQL)
message("Adding MySQL db driver")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_MYSQL")
include_directories(${MYSQLH_PATH})
add_subdirectory(src/drivers/mysql)
target_link_libraries(sysbench sbmysql)
target_link_libraries(sysbench ${LIBMYSQL_LIB})
endif()

###########################
# PostgreSQL driver block #
###########################
if(USE_PGSQL)
message("Adding pgsql driver")
if(UNIX)
message( FATAL_ERROR "UNIX/Linux not yet supported, CMake will exit.")
endif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_PGSQL")
include_directories(${PGSQLH_PATH})
add_subdirectory(src/drivers/pgsql)
target_link_libraries (sysbench sbpgsql)
target_link_libraries (sysbench ${LIBPGSQL_LIB})
message("Add done")
endif(USE_PGSQL)
message("Adding pgsql db driver")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_PGSQL")
include_directories(${PGSQLH_PATH})
add_subdirectory(src/drivers/pgsql)
target_link_libraries(sysbench sbpgsql)
target_link_libraries(sysbench ${LIBPGSQL_LIB})
endif()

#######################
# Oracle driver block #
#######################
if(USE_ORACLE)
message("Adding oracle driver")
if(UNIX)
message( FATAL_ERROR "UNIX/Linux not yet supported, CMake will exit.")
endif(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_ORACLE")
include_directories(${ORACLEH_PATH})
add_subdirectory(src/drivers/oracle)
target_link_libraries (sysbench sboracle)
target_link_libraries (sysbench ${LIBORACLE_LIB})
message("Add done")
endif(USE_ORACLE)
message("Adding oracle db driver")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_ORACLE")
include_directories(${ORACLEH_PATH})
add_subdirectory(src/drivers/oracle)
target_link_libraries(sysbench sboracle)
target_link_libraries(sysbench ${LIBORACLE_LIB})
endif()

###################################################
# Test modules (cpu, fileio, mutex, threads, mem) #
###################################################
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/tests/cpu ${CMAKE_CURRENT_SOURCE_DIR}/src/tests/fileio)

message("Adding test cpu")
Expand Down Expand Up @@ -370,6 +494,9 @@ add_subdirectory(src/tests/memory)
target_link_libraries (sysbench sbmemory)
message("Add done")

###################################################
# Final linking #
###################################################
if (Threads_FOUND)
target_link_libraries(sysbench ${CMAKE_THREAD_LIBS_INIT})
endif()
Expand All @@ -382,5 +509,4 @@ if (HAVE_LIBAIO)
target_link_libraries (sysbench aio)
endif()

message("script complete")

message("script complete")
3 changes: 3 additions & 0 deletions client_source/sysbench-lua/src/drivers/pgsql/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
add_library(sbpgsql STATIC drv_pgsql.c)
target_link_libraries(sbpgsql ${LIBPGSQL_LIB})
Loading