enable apr_atomic test again

This commit is contained in:
Luboš Uhliarik 2023-02-10 02:28:07 +01:00
parent 280f685fb3
commit 3076dbcb1e
3 changed files with 35 additions and 17 deletions

View File

@ -1,14 +0,0 @@
diff --git a/test/testatomic.c b/test/testatomic.c
index bf388c7..03e1c32 100644
--- a/test/testatomic.c
+++ b/test/testatomic.c
@@ -953,7 +953,8 @@ abts_suite *testatomic(abts_suite *suite)
abts_run_test(suite, test_atomics_threaded64, NULL);
abts_run_test(suite, test_atomics_busyloop_threaded, NULL);
abts_run_test(suite, test_atomics_busyloop_threaded64, NULL);
- abts_run_test(suite, test_atomics_threaded_setread64, NULL);
+// disable this test due to i686 issues
+// abts_run_test(suite, test_atomics_threaded_setread64, NULL);
#endif
return suite;

29
apr-1.7.2-r1907541.patch Normal file
View File

@ -0,0 +1,29 @@
--- a/atomic/unix/mutex64.c 2023/02/09 12:45:02 1907540
+++ b/atomic/unix/mutex64.c 2023/02/09 13:36:18 1907541
@@ -96,7 +96,26 @@
APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
{
+ /* On 32bit CPUs this loads with two instructions (tearing),
+ * so a lock is needed to ensure atomicity.
+ *
+ * APR_SIZEOF_VOIDP is probably not the right check for 32 vs 64 bits CPUs
+ * but it spares an (hardly-)exhaustive list of supported CPUs (and using
+ * assembly). If APR_SIZEOF_VOIDP==4 means that the compiler generates
+ * 32bit instructions (-m32 or whatever) then it's the right check though.
+ */
+#if APR_SIZEOF_VOIDP >= 8
return *mem;
+#else
+ apr_uint64_t cur_value;
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+
+ cur_value = *mem;
+
+ MUTEX_UNLOCK(mutex);
+
+ return cur_value;
+#endif
}
APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)

View File

@ -12,7 +12,7 @@
Summary: Apache Portable Runtime library
Name: apr
Version: 1.7.2
Release: 1%{?dist}
Release: 2%{?dist}
# ASL 2.0: everything
# ISC: network_io/apr-1.4.6/network_io/unix/inet_?to?.c
# BSD with advertising: strings/apr_snprintf.c, strings/apr_fnmatch.c,
@ -27,7 +27,7 @@ Patch1: apr-1.7.2-libdir.patch
Patch2: apr-1.2.7-pkgconf.patch
Patch3: apr-1.7.0-deepbind.patch
Patch4: apr-1.7.2-autoconf.patch
Patch5: apr-1.7.2-disable-atomic-read-test.patch
Patch5: apr-1.7.2-r1907541.patch
BuildRequires: gcc, autoconf, libtool, libuuid-devel, python3
BuildRequires: make
@ -54,7 +54,7 @@ C data structures and routines.
%patch2 -p1 -b .pkgconf
%patch3 -p1 -b .deepbind
%patch4 -p1 -b .autoconf-2-71
%patch5 -p1 -b .dis-atomic-rd-test
%patch5 -p1 -b .r1907541
%build
# regenerate configure script etc.
@ -144,6 +144,9 @@ popd
%{_datadir}/aclocal/*.m4
%changelog
* Fri Feb 10 2023 Luboš Uhliarik <luhliari@redhat.com> - 1.7.2-2
- enable apr_atomic test again
* Thu Feb 02 2023 Luboš Uhliarik <luhliari@redhat.com> - 1.7.2-1
- new version 1.7.2