Hello.

I initially planned to send the diff only after achieving successful
completion of all the tests. However, while fixing the tests, I
discovered a flaw that causes part of the abseil code to work
incorrectly. Therefore, I decided to send what was already done and
fix the remaining three tests later.

If this is not ok, please apply at least
patch-absl_base_internal_raw_logging_cc, it contains the necessary
fixes.

The other contents of the diff is the turn on of the tests building.
Under macppc I, alas, could not test it - the build crashes with out
of memory. Checked only under amd64, there result of tests execution:

98% tests passed, 3 tests failed out of 180

Total Test time (real) = 445.38 sec

The following tests FAILED:
  132 - absl_charconv_test (Failed)
  140 - absl_str_format_convert_test (Failed)
  167 - absl_time_test (Failed)


I will be glad to your comments and objections, if there are none,
I will be glad to see it committed. Thanks in advance.

--
Wbr, Andrew Krasavin

diff --git a/devel/abseil-cpp/Makefile b/devel/abseil-cpp/Makefile
index 4fb8a93ab48..5d869d82dd8 100644
--- a/devel/abseil-cpp/Makefile
+++ b/devel/abseil-cpp/Makefile
@@ -1,6 +1,7 @@
 # $OpenBSD: Makefile,v 1.1.1.1 2021/12/18 19:38:17 kn Exp $
COMMENT = abseil common libraries (c++)
+REVISION =     0
 CATEGORIES =   devel
GH_ACCOUNT = abseil
@@ -99,6 +100,19 @@ CONFIGURE_ARGS +=   -DCMAKE_CXX_STANDARD=17
 # to ensure that our project builds correctly.
 CONFIGURE_ARGS +=      -DABSL_PROPAGATE_CXX_STD:BOOL=ON
-NO_TEST = Yes
+# use googletest from ports
+CONFIGURE_ARGS +=      
-DABSL_USE_EXTERNAL_GOOGLETEST:BOOL=${LOCALBASE}/include/gtest
+# turn on tests builds
+CONFIGURE_ARGS +=      -DBUILD_TESTING:BOOL=ON
+
+# use TEST_TMPDIR instead of /tmp for tests temp data (like in bazel build)
+TEST_ENV +=            TEST_TMPDIR=${WRKBUILD}/test_tmp \
+                       LD_LIBRARY_PATH=/usr/lib:${WRKBUILD}/test_lib
+
+pre-test:
+       @mkdir -p ${WRKBUILD}/test_tmp
+       @mkdir -p ${WRKBUILD}/test_lib
+       cd ${WRKBUILD}/test_lib && \
+                find ${WRKBUILD} -name "*.so.0.0" | xargs -I {} ln -s {} .
.include <bsd.port.mk>
diff --git a/devel/abseil-cpp/patches/patch-absl_base_internal_raw_logging_cc 
b/devel/abseil-cpp/patches/patch-absl_base_internal_raw_logging_cc
new file mode 100644
index 00000000000..71ef528b32b
--- /dev/null
+++ b/devel/abseil-cpp/patches/patch-absl_base_internal_raw_logging_cc
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Index: absl/base/internal/raw_logging.cc
+--- absl/base/internal/raw_logging.cc.orig
++++ absl/base/internal/raw_logging.cc
+@@ -36,7 +36,7 @@
+ // This preprocessor token is also defined in raw_io.cc.  If you need to copy
+ // this, consider moving both to config.h instead.
+ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
+-    defined(__Fuchsia__) || defined(__native_client__) || \
++    defined(__Fuchsia__) || defined(__native_client__) || 
defined(__OpenBSD__) || \
+     defined(__EMSCRIPTEN__) || defined(__ASYLO__)
+ + #include <unistd.h>
+@@ -50,7 +50,7 @@
+ // ABSL_HAVE_SYSCALL_WRITE is defined when the platform provides the syscall
+ //   syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len);
+ // for low level operations that want to avoid libc.
+-#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
++#if (defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && 
!defined(__ANDROID__)
+ #include <sys/syscall.h>
+ #define ABSL_HAVE_SYSCALL_WRITE 1
+ #define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
diff --git a/devel/abseil-cpp/patches/patch-absl_debugging_CMakeLists_txt 
b/devel/abseil-cpp/patches/patch-absl_debugging_CMakeLists_txt
new file mode 100644
index 00000000000..df5a9e9ed5d
--- /dev/null
+++ b/devel/abseil-cpp/patches/patch-absl_debugging_CMakeLists_txt
@@ -0,0 +1,56 @@
+$OpenBSD$
+
+Disable all tests that require a leak sanitizer because
+OpenBSD does not support it.
+
+Index: absl/debugging/CMakeLists.txt
+--- absl/debugging/CMakeLists.txt.orig
++++ absl/debugging/CMakeLists.txt
+@@ -225,6 +225,7 @@ absl_cc_library(
+   PUBLIC
+ )
+ ++if (NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ absl_cc_library(
+   NAME
+     leak_check_api_enabled_for_testing
+@@ -237,6 +238,7 @@ absl_cc_library(
+     $<$<BOOL:${ABSL_HAVE_LSAN}>:-DLEAK_SANITIZER>
+   TESTONLY
+ )
++endif()
+ + absl_cc_library(
+   NAME
+@@ -251,6 +253,7 @@ absl_cc_library(
+   TESTONLY
+ )
+ ++if (NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ absl_cc_test(
+   NAME
+     leak_check_test
+@@ -266,6 +269,7 @@ absl_cc_test(
+     absl::base
+     GTest::gmock_main
+ )
++endif()
+ + absl_cc_test(
+   NAME
+@@ -281,6 +285,7 @@ absl_cc_test(
+     GTest::gmock_main
+ )
+ ++if (NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+ absl_cc_test(
+   NAME
+     disabled_leak_check_test
+@@ -297,6 +302,7 @@ absl_cc_test(
+     absl::raw_logging_internal
+     GTest::gmock_main
+ )
++endif()
+ + absl_cc_library(
+   NAME

Reply via email to