Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ blocks:
jobs:
- name: 'Build configuration checks'
commands:
- wget -O rapidjson-dev.deb https://launchpad.net/ubuntu/+archive/primary/+files/rapidjson-dev_1.1.0+dfsg2-3_all.deb
- sudo dpkg -i rapidjson-dev.deb
- python3 -m pip install -U pip
- ./packaging/tools/build-configurations-checks.sh
- ./packaging/tools/build-configurations-checks.sh make quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1
- ./packaging/tools/build-configurations-checks.sh cmake quay.io/pypa/manylinux_2_28_x86_64:2024.07.01-1
- ./packaging/tools/build-configurations-checks.sh make alpine:3.16.9
- ./packaging/tools/build-configurations-checks.sh cmake alpine:3.16.9

- name: 'Build and integration tests with "classic" protocol'
commands:
- wget -O rapidjson-dev.deb https://launchpad.net/ubuntu/+archive/primary/+files/rapidjson-dev_1.1.0+dfsg2-3_all.deb
Expand Down
50 changes: 48 additions & 2 deletions packaging/tools/build-configurations-checks.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
#!/bin/bash
#!/bin/sh
set -e

build_tool="$1"
docker_image="$2"

if [ -n "$docker_image" ]; then
echo "Running in docker image: $docker_image"
# Running on the host, spin up the docker builder.
exec docker run -v "$PWD:/v" -w /v $docker_image ./packaging/tools/build-configurations-checks.sh $build_tool
# Only reached on exec error
exit $?
fi

if [ -z "$build_tool" ]; then
# Default to using make if no build tool is specified.
build_tool="make"
fi

if grep -q alpine /etc/os-release 2>/dev/null ; then
# Alpine
apk add \
bash gcc g++ make $build_tool git bsd-compat-headers
fi

# Clone the repo so other builds are unaffected of what we're doing
# and we get a pristine build tree.
git config --system --add safe.directory '/v/.git'
git config --system --add safe.directory '/librdkafka/.git'
git clone /v /librdkafka

cd /librdkafka

# Disable all flags to make sure it
# compiles correctly in all cases
./configure --install-deps --disable-ssl --disable-gssapi \
if [ "$build_tool" = "make" ]; then
./configure --disable-ssl --disable-gssapi \
--disable-curl --disable-zlib \
--disable-zstd --disable-lz4-ext --disable-regex-ext \
--disable-c11threads --disable-syslog \
--enable-werror --enable-devel
cat ./config.h
else
cmake -DWITH_SSL=OFF -DWITH_SASL_CYRUS=OFF \
-DWITH_CURL=OFF -DWITH_ZLIB=OFF \
-DWITH_ZSTD=OFF -DHAVE_REGEX=OFF -DWITH_C11THREADS=OFF \
-DWITH_LIBDL=OFF
cat ./generated/config.h
fi
make -j

export CI=true
if [ "$build_tool" = "make" ]; then
make -j -C tests run_local_quick
else
ctest -VV -R RdKafkaTestBrokerLessQuick --output-on-failure
fi
2 changes: 1 addition & 1 deletion src/rdkafka_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include <windows.h>
#endif

#ifdef WITH_OAUTHBEARER_OIDC
#if WITH_OAUTHBEARER_OIDC
#include <curl/curl.h>
#endif

Expand Down
16 changes: 15 additions & 1 deletion tests/0066-plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ static void do_test_plugin() {
NULL,
};

RdKafka::Conf *conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);
if (conf->set("plugin.library.paths",
"interceptor_test/interceptor_test_dummy", errstr) &&
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than relying on the enum-to-bool conversion in if (conf->set(...)), explicitly compare the result to RdKafka::Conf::CONF_OK (or the appropriate error code) to make the intent clear.

Suggested change
"interceptor_test/interceptor_test_dummy", errstr) &&
"interceptor_test/interceptor_test_dummy", errstr) == RdKafka::Conf::CONF_OK &&

Copilot uses AI. Check for mistakes.

errstr.find(
"Configuration property \"plugin.library.paths\" not supported") !=
std::string::npos) {
delete conf;
Test::Skip(
"Configuration property \"plugin.library.paths\" not supported in this "
"build\n");
Comment on lines +75 to +81
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The same error message literal is repeated twice; consider extracting it into a named constant to avoid duplication and simplify future updates.

Suggested change
errstr.find(
"Configuration property \"plugin.library.paths\" not supported") !=
std::string::npos) {
delete conf;
Test::Skip(
"Configuration property \"plugin.library.paths\" not supported in this "
"build\n");
errstr.find(PLUGIN_PATHS_ERROR) != std::string::npos) {
delete conf;
Test::Skip(tostr() << PLUGIN_PATHS_ERROR << " in this build\n");

Copilot uses AI. Check for mistakes.

return;
}
delete conf;

char cwd[512], *pcwd;
#ifdef _WIN32
pcwd = _getcwd(cwd, sizeof(cwd) - 1);
Expand All @@ -84,7 +98,7 @@ static void do_test_plugin() {
ictest_cnt_init(&ictest.on_new, 1, 1);

/* Config for intercepted client */
RdKafka::Conf *conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);
conf = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);

for (int i = 0; config[i]; i += 2) {
Test::Say(tostr() << "set(" << config[i] << ", " << config[i + 1] << ")\n");
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ target_link_libraries(test-runner PUBLIC rdkafka++)
add_test(NAME RdKafkaTestInParallel COMMAND test-runner -p5)
add_test(NAME RdKafkaTestSequentially COMMAND test-runner -p1)
add_test(NAME RdKafkaTestBrokerLess COMMAND test-runner -p5 -l)
add_test(NAME RdKafkaTestBrokerLessQuick COMMAND test-runner -p5 -l -Q)

if(NOT WIN32 AND NOT APPLE)
set(tests_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Expand Down