tests: skip tests on Win32 that rely on kafka-topics.sh

Signed-off-by: lb1107039128 <liubo1@xfusion.com>
This commit is contained in:
lb1107039128 2023-12-25 11:46:26 +08:00
parent f9a312e6fc
commit 7c576dc7cf
2 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,69 @@
From 65f724614c1e8a2a4d7b76c6dc26eaf514c83975 Mon Sep 17 00:00:00 2001
From: Magnus Edenhill <magnus@edenhill.se>
Date: Tue, 13 Feb 2018 20:44:46 +0100
Subject: [PATCH] tests: skip tests on Win32 that rely on kafka-topics.sh
---
tests/0011-produce_batch.c | 3 ++-
tests/0026-consume_pause.c | 3 ++-
tests/0048-partitioner.c | 3 ++-
tests/test.c | 2 +-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/0011-produce_batch.c b/tests/0011-produce_batch.c
index 1796d0a2..5c550a83 100644
--- a/tests/0011-produce_batch.c
+++ b/tests/0011-produce_batch.c
@@ -545,6 +545,7 @@ int main_0011_produce_batch (int argc, char **argv) {
test_message_partitioner_wo_per_message_flag();
test_single_partition();
test_partitioner();
- test_per_message_partition_flag();
+ if (test_can_create_topics(1))
+ test_per_message_partition_flag();
return 0;
}
diff --git a/tests/0026-consume_pause.c b/tests/0026-consume_pause.c
index eeb2ba80..697e0f92 100644
--- a/tests/0026-consume_pause.c
+++ b/tests/0026-consume_pause.c
@@ -221,7 +221,8 @@ static int consume_pause (void) {
int main_0026_consume_pause (int argc, char **argv) {
int fails = 0;
- fails += consume_pause();
+ if (test_can_create_topics(1))
+ fails += consume_pause();
if (fails > 0)
TEST_FAIL("See %d previous error(s)\n", fails);
diff --git a/tests/0048-partitioner.c b/tests/0048-partitioner.c
index 601cb4ef..46a05117 100644
--- a/tests/0048-partitioner.c
+++ b/tests/0048-partitioner.c
@@ -281,7 +281,8 @@ static void do_test_partitioners (void) {
}
int main_0048_partitioner (int argc, char **argv) {
- do_test_partitioners();
+ if (test_can_create_topics(0))
+ do_test_partitioners();
do_test_failed_partitioning();
return 0;
}
diff --git a/tests/test.c b/tests/test.c
index 9cff714e..98aa8c74 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -3468,7 +3468,7 @@ void test_report_add (struct test *test, const char *fmt, ...) {
int test_can_create_topics (int skip) {
#ifdef _MSC_VER
if (skip)
- TEST_SKIP("Cannot create topics on Win32");
+ TEST_SKIP("Cannot create topics on Win32\n");
return 0;
#else
--
2.42.0.windows.2

View File

@ -1,6 +1,6 @@
Name: librdkafka Name: librdkafka
Version: 0.11.4 Version: 0.11.4
Release: 3 Release: 4
Summary: C library implementation of the Apache Kafka protocol Summary: C library implementation of the Apache Kafka protocol
License: BSD License: BSD
URL: https://github.com/edenhill/librdkafka URL: https://github.com/edenhill/librdkafka
@ -8,6 +8,8 @@ Source0: https://github.com/edenhill/librdkafka/archive/v%{version}.tar.g
BuildRequires: gcc-c++ python2 openssl-devel cyrus-sasl-devel lz4-devel BuildRequires: gcc-c++ python2 openssl-devel cyrus-sasl-devel lz4-devel
Patch0001: 0001-tests-skip-tests-on-Win32-that-rely-on-kafka-topics.patch
%description %description
ibrdkafka is a C library implementation of the Apache Kafka protocol, providing Producer, Consumer ibrdkafka is a C library implementation of the Apache Kafka protocol, providing Producer, Consumer
and Admin clients. It was designed with message delivery reliability and high performance in mind, and Admin clients. It was designed with message delivery reliability and high performance in mind,
@ -53,6 +55,9 @@ make check
%{_libdir}/pkgconfig/* %{_libdir}/pkgconfig/*
%changelog %changelog
* Mon Dec 25 2023 liubo <liubo1@xfusion.com> - 0.11.4-4
- tests: skip tests on Win32 that rely on kafka-topics.sh
* Fri Dec 20 2019 daiqianwen <daiqianwen@huawei.com> - 0.11.4-3 * Fri Dec 20 2019 daiqianwen <daiqianwen@huawei.com> - 0.11.4-3
- Package init - Package init