Merge lp:~james-page/ubuntu/precise/zookeeper/arm-ftbfs-fixes into lp:ubuntu/precise/zookeeper

Proposed by James Page
Status: Merged
Merge reported by: James Page
Merged at revision: not available
Proposed branch: lp:~james-page/ubuntu/precise/zookeeper/arm-ftbfs-fixes
Merge into: lp:ubuntu/precise/zookeeper
Diff against target: 214 lines (+135/-13)
7 files modified
.pc/applied-patches (+1/-0)
.pc/fixes/ZOOKEEPER-1374/src/c/tests/ThreadingUtil.cc (+79/-0)
debian/changelog (+11/-0)
debian/patches/fixes/ZOOKEEPER-1374 (+38/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-0)
src/c/tests/ThreadingUtil.cc (+2/-13)
To merge this branch: bzr merge lp:~james-page/ubuntu/precise/zookeeper/arm-ftbfs-fixes
Reviewer Review Type Date Requested Status
Matthias Klose Approve
Clint Byrum Pending
Review via email: mp+89940@code.launchpad.net

Description of the change

This MP addresses testing on armel/armhf:

1) The current upstream C test code is not compatible with arm; patched to use _sync_* primitives rather than ASM code for atomic operations in the test code. Reported upstream with patch submitted https://issues.apache.org/jira/browse/ZOOKEEPER-1374

2) My panda won't run the Java core test suite through the completion; I'm guessing the same will hold true on the buildds so I've disabled execution on arm based architectures.

Builds OK on my panda locally.

To post a comment you must log in.
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Excerpts from James Page's message of Tue Jan 24 16:53:30 UTC 2012:
> James Page has proposed merging lp:~james-page/ubuntu/precise/zookeeper/arm-ftbfs-fixes into lp:ubuntu/zookeeper.
>
> Requested reviews:
> Clint Byrum (clint-fewbar)
> Related bugs:
> Bug #920871 in zookeeper (Ubuntu): "zookeeper 3.3.4+dfsg1-2ubuntu2 FTBFS on armel and armhf"
> https://bugs.launchpad.net/ubuntu/+source/zookeeper/+bug/920871
>
> For more details, see:
> https://code.launchpad.net/~james-page/ubuntu/precise/zookeeper/arm-ftbfs-fixes/+merge/89940
>
> This MP addresses testing on armel/armhf:
>
> 1) The current upstream C test code is not compatible with arm; patched to use _sync_* primitives rather than ASM code for atomic operations in the test code. Reported upstream with patch submitted https://issues.apache.org/jira/browse/ZOOKEEPER-1374
>
> 2) My panda won't run the Java core test suite through the completion; I'm guessing the same will hold true on the buildds so I've disabled execution on arm based architectures.
>
> Builds OK on my panda locally.

This looks great, but I don't know that I'm qualified to evaluate it,
having almost no assembly or arm porting experience.

+1, but with the disclaimer that I'm not sure at all why it works. :)

Revision history for this message
Matthias Klose (doko) wrote :

looks fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2012-01-06 13:58:23 +0000
3+++ .pc/applied-patches 2012-01-24 16:52:20 +0000
4@@ -4,3 +4,4 @@
5 fixes/ZOOKEEPER-705
6 fixes/ZOOKEEPER-1033
7 fix-broken-c-client-unittest.patch
8+fixes/ZOOKEEPER-1374
9
10=== added directory '.pc/fixes/ZOOKEEPER-1374'
11=== added directory '.pc/fixes/ZOOKEEPER-1374/src'
12=== added directory '.pc/fixes/ZOOKEEPER-1374/src/c'
13=== added directory '.pc/fixes/ZOOKEEPER-1374/src/c/tests'
14=== added file '.pc/fixes/ZOOKEEPER-1374/src/c/tests/ThreadingUtil.cc'
15--- .pc/fixes/ZOOKEEPER-1374/src/c/tests/ThreadingUtil.cc 1970-01-01 00:00:00 +0000
16+++ .pc/fixes/ZOOKEEPER-1374/src/c/tests/ThreadingUtil.cc 2012-01-24 16:52:20 +0000
17@@ -0,0 +1,79 @@
18+/**
19+ * Licensed to the Apache Software Foundation (ASF) under one
20+ * or more contributor license agreements. See the NOTICE file
21+ * distributed with this work for additional information
22+ * regarding copyright ownership. The ASF licenses this file
23+ * to you under the Apache License, Version 2.0 (the
24+ * "License"); you may not use this file except in compliance
25+ * with the License. You may obtain a copy of the License at
26+ *
27+ * http://www.apache.org/licenses/LICENSE-2.0
28+ *
29+ * Unless required by applicable law or agreed to in writing, software
30+ * distributed under the License is distributed on an "AS IS" BASIS,
31+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32+ * See the License for the specific language governing permissions and
33+ * limitations under the License.
34+ */
35+
36+#include <sys/types.h>
37+#include "ThreadingUtil.h"
38+#include "LibCSymTable.h"
39+
40+#ifdef THREADED
41+
42+// ****************************************************************************
43+// Mutex wrapper
44+struct Mutex::Impl{
45+ Impl(){
46+ LIBC_SYMBOLS.pthread_mutex_init(&mut_, 0);
47+ }
48+ ~Impl(){
49+ LIBC_SYMBOLS.pthread_mutex_destroy(&mut_);
50+ }
51+ pthread_mutex_t mut_;
52+};
53+
54+Mutex::Mutex():impl_(new Impl) {}
55+Mutex::~Mutex() { delete impl_;}
56+void Mutex::acquire() {
57+ LIBC_SYMBOLS.pthread_mutex_lock(&impl_->mut_);
58+}
59+void Mutex::release() {
60+ LIBC_SYMBOLS.pthread_mutex_unlock(&impl_->mut_);
61+}
62+
63+// ****************************************************************************
64+// Atomics
65+int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr)
66+{
67+ int32_t result;
68+ __asm__ __volatile__(
69+ "lock xaddl %0,%1\n"
70+ : "=r"(result), "=m"(*operand)
71+ : "0"(incr)
72+ : "memory");
73+ return result;
74+}
75+int32_t atomic_fetch_store(volatile int32_t *ptr, int32_t value)
76+{
77+ int32_t result;
78+ __asm__ __volatile__("lock xchgl %0,%1\n"
79+ : "=r"(result), "=m"(*ptr)
80+ : "0"(value)
81+ : "memory");
82+ return result;
83+}
84+#else
85+int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr){
86+ int32_t v=*operand;
87+ *operand+=incr;
88+ return v;
89+}
90+int32_t atomic_fetch_store(volatile int32_t *ptr, int32_t value)
91+{
92+ int32_t result=*ptr;
93+ *ptr=value;
94+ return result;
95+}
96+#endif // THREADED
97
98=== modified file 'debian/changelog'
99--- debian/changelog 2012-01-06 13:58:23 +0000
100+++ debian/changelog 2012-01-24 16:52:20 +0000
101@@ -1,3 +1,14 @@
102+zookeeper (3.3.4+dfsg1-2ubuntu3) precise; urgency=low
103+
104+ * Fix FTBFS of test suite on armel/armhf (LP: #920871):
105+ - d/patches/fixes/ZOOKEEPER-1374: Use __sync_* primitives
106+ instead of ASM code to improve portability across supported
107+ platforms.
108+ - d/rules: Don't run full core Java test suite on arm architectures
109+ as it breaks due to JVM incompatibilities.
110+
111+ -- James Page <james.page@ubuntu.com> Tue, 24 Jan 2012 15:14:43 +0000
112+
113 zookeeper (3.3.4+dfsg1-2ubuntu2) precise; urgency=low
114
115 [ Clint Byrum ]
116
117=== added file 'debian/patches/fixes/ZOOKEEPER-1374'
118--- debian/patches/fixes/ZOOKEEPER-1374 1970-01-01 00:00:00 +0000
119+++ debian/patches/fixes/ZOOKEEPER-1374 2012-01-24 16:52:20 +0000
120@@ -0,0 +1,38 @@
121+Description: Use GCC primitives instead of ASM for better cross
122+ platform support.
123+Author: James Page <james.page@ubuntu.com>
124+Forwarded: https://issues.apache.org/jira/browse/ZOOKEEPER-1374
125+
126+Index: zookeeper/src/c/tests/ThreadingUtil.cc
127+===================================================================
128+--- zookeeper.orig/src/c/tests/ThreadingUtil.cc 2012-01-24 13:13:17.231731255 +0000
129++++ zookeeper/src/c/tests/ThreadingUtil.cc 2012-01-24 13:14:45.683733682 +0000
130+@@ -45,24 +45,13 @@
131+
132+ // ****************************************************************************
133+ // Atomics
134+-int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr)
135++int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr)
136+ {
137+- int32_t result;
138+- __asm__ __volatile__(
139+- "lock xaddl %0,%1\n"
140+- : "=r"(result), "=m"(*operand)
141+- : "0"(incr)
142+- : "memory");
143+- return result;
144++ return __sync_fetch_and_add(operand,incr);
145+ }
146+-int32_t atomic_fetch_store(volatile int32_t *ptr, int32_t value)
147++int32_t atomic_fetch_store(volatile int32_t *ptr, int32_t value)
148+ {
149+- int32_t result;
150+- __asm__ __volatile__("lock xchgl %0,%1\n"
151+- : "=r"(result), "=m"(*ptr)
152+- : "0"(value)
153+- : "memory");
154+- return result;
155++ return __sync_lock_test_and_set(ptr,value);
156+ }
157+ #else
158+ int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr){
159
160=== modified file 'debian/patches/series'
161--- debian/patches/series 2012-01-06 13:58:23 +0000
162+++ debian/patches/series 2012-01-24 16:52:20 +0000
163@@ -4,3 +4,4 @@
164 fixes/ZOOKEEPER-705
165 fixes/ZOOKEEPER-1033
166 fix-broken-c-client-unittest.patch
167+fixes/ZOOKEEPER-1374
168
169=== modified file 'debian/rules'
170--- debian/rules 2012-01-06 13:58:23 +0000
171+++ debian/rules 2012-01-24 16:52:20 +0000
172@@ -63,10 +63,13 @@
173 $(MAKE) -C src/c zktest-mt
174 cd src/c && ./zktest-mt
175
176+# Unable to run the full Java test suite on ARM architectures
177+ifeq (,$(findstring arm, $(DEB_BUILD_ARCH)))
178 override_dh_auto_test-indep:
179 # Run core Java test suite against zookeeper
180 ant -Dversion=$(DEB_UPSTREAM_VERSION) -DlastRevision=-1 test-core-java
181 endif
182+endif
183
184 override_dh_clean:
185 dh_clean --exclude=src/java \
186
187=== modified file 'src/c/tests/ThreadingUtil.cc'
188--- src/c/tests/ThreadingUtil.cc 2010-01-28 12:07:38 +0000
189+++ src/c/tests/ThreadingUtil.cc 2012-01-24 16:52:20 +0000
190@@ -47,22 +47,11 @@
191 // Atomics
192 int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr)
193 {
194- int32_t result;
195- __asm__ __volatile__(
196- "lock xaddl %0,%1\n"
197- : "=r"(result), "=m"(*operand)
198- : "0"(incr)
199- : "memory");
200- return result;
201+ return __sync_fetch_and_add(operand,incr);
202 }
203 int32_t atomic_fetch_store(volatile int32_t *ptr, int32_t value)
204 {
205- int32_t result;
206- __asm__ __volatile__("lock xchgl %0,%1\n"
207- : "=r"(result), "=m"(*ptr)
208- : "0"(value)
209- : "memory");
210- return result;
211+ return __sync_lock_test_and_set(ptr,value);
212 }
213 #else
214 int32_t atomic_post_incr(volatile int32_t* operand, int32_t incr){

Subscribers

People subscribed via source and target branches

to all changes: