libdbiDrivers: fix compile errors in tests, backport patches

This commit is contained in:
Yongun Seong
2024-12-28 23:04:00 +01:00
committed by Pascal Bach
parent 7bd3a283c0
commit e8ef3a063c
4 changed files with 84 additions and 1 deletions
@@ -0,0 +1,23 @@
commit 470b58e15dc6f406899b1695aec7fc98986b8f14
Author: Jan Engelhardt <jengelh@inai.de>
Date: Fri Jan 27 09:56:44 2017 +0100
build: resolve compiler warning for wait(2)
src/unit.c: In function "wait_for_child_process":
src/unit.c:229:5: warning: implicit declaration of function "wait" [-Wimplicit-function-declaration]
wait(&status);
diff --git a/tests/cgreen/src/unit.c b/tests/cgreen/src/unit.c
index 7753ff1..bdd236f 100644
--- a/tests/cgreen/src/unit.c
+++ b/tests/cgreen/src/unit.c
@@ -9,6 +9,7 @@
#include <stdarg.h>
#include <unistd.h>
#include <signal.h>
+#include <sys/wait.h>
enum {test_function, test_suite};
@@ -0,0 +1,22 @@
commit 9f3788269befd2e4290eef1df4b014bc2385d801
Author: Jan Engelhardt <jengelh@inai.de>
Date: Sat Sep 7 22:51:05 2013 +0200
build: resolve rpmlint aborting due to bad code
diff --git a/tests/cgreen/src/constraint.c b/tests/cgreen/src/constraint.c
index c19c0dd..b0fbfb8 100644
--- a/tests/cgreen/src/constraint.c
+++ b/tests/cgreen/src/constraint.c
@@ -164,8 +164,8 @@ static void test_want_double(Constraint *constraint, const char *function, intpt
}
static int compare_using_matcher(Constraint *constraint, intptr_t actual) {
- int (*matches)(const void*) = constraint->expected;
- return matches(actual);
+ int (*matches)(const void*) = (void *)(intptr_t)constraint->expected;
+ return matches((void *)actual);
}
static void test_with_matcher(Constraint *constraint, const char *function, const char* matcher_name, intptr_t matcher_function, const char *test_file, int test_line, TestReporter *reporter) {
@@ -0,0 +1,32 @@
diff --git a/tests/cgreen/src/constraint.c b/tests/cgreen/src/constraint.c
index 56c3625..d8972bb 100644
--- a/tests/cgreen/src/constraint.c
+++ b/tests/cgreen/src/constraint.c
@@ -22,7 +22,7 @@ static double unbox_double(intptr_t box);
static double as_double(intptr_t box);
static int compare_using_matcher(Constraint *constraint, intptr_t actual);
-static void test_with_matcher(Constraint *constraint, const char *function, const char* matcher_name, intptr_t actual, const char *test_file, int test_line, TestReporter *reporter);
+static void test_with_matcher(Constraint *constraint, const char *function, intptr_t actual, const char *test_file, int test_line, TestReporter *reporter);
void destroy_constraint(void *abstract) {
@@ -168,15 +168,14 @@ static int compare_using_matcher(Constraint *constraint, intptr_t actual) {
return matches((void *)actual);
}
-static void test_with_matcher(Constraint *constraint, const char *function, const char* matcher_name, intptr_t matcher_function, const char *test_file, int test_line, TestReporter *reporter) {
+static void test_with_matcher(Constraint *constraint, const char *function, intptr_t matcher_function, const char *test_file, int test_line, TestReporter *reporter) {
(*reporter->assert_true)(
reporter,
test_file,
test_line,
(*constraint->compare)(constraint, matcher_function),
- "Wanted parameter [%s] to match [%s] in function [%s]",
+ "Wanted parameter [%s] to match [nil] in function [%s]",
constraint->parameter,
- matcher_name,
function);
}
+7 -1
View File
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "mirror://sourceforge/libdbi-drivers/libdbi-drivers-${version}.tar.gz";
sha256 = "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3";
hash = "sha256-Q9LqzVc6T6/ylvqSXdl/vyrtvxrjXGJjR4IQxhAEyFQ=";
};
buildInputs = [
@@ -27,6 +27,12 @@ stdenv.mkDerivation rec {
patches = [
# https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/24f48b86c8988ee3aaebc5f303d71e9d789f77b6
./libdbi-drivers-0.9.0-buffer_overflow.patch
# https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/470b58e15dc6f406899b1695aec7fc98986b8f14
./libdbi-drivers-0.9.0-470b58e15-wait-include.patch
# https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/9f3788269befd2e4290eef1df4b014bc2385d801
./libdbi-drivers-0.9.0-9f378826-compare-type.patch
# fix function pointer type mismatches in tests
./libdbi-drivers-0.9.0-function-types.patch
];
postPatch = ''