Commit cd9113d
Fix race condition in RCPTestWorkbenchAdvisor with CountDownLatch synchronization
The flaky test was caused by a race condition in RCPTestWorkbenchAdvisor.java.
The test spawns 4 background threads during preStartup() that schedule async/sync
runnables on the display. However, there was no guarantee these runnables would
execute before postStartup() marked the workbench as "started" (by setting
started = true). This meant asyncWithDisplayAccess could still be null when
the test assertions ran, causing intermittent failures.
This change adds a CountDownLatch to ensure all 4 async/sync operations complete
before marking the workbench as started.
Key changes to RCPTestWorkbenchAdvisor.java:
- Added CountDownLatch field initialized as a constant with count of 4
- Added proper imports for CountDownLatch and TimeUnit
- Simplified Boolean assignments to use !isSTARTED() directly
- Added finally blocks in setupSyncDisplayThread() and setupAsyncDisplayThread()
to call asyncLatch.countDown()
- Modified postStartup() to await latch completion with 5-second timeout
- Replaced warning logs with AssertionError on timeout and RuntimeException
on interruption to ensure test failures are explicit
Also bumps version of org.eclipse.ui.tests.harness for 4.38 stream.
Fixes #1517
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 3caaf9b commit cd9113d
File tree
2 files changed
+60
-15
lines changed- tests/org.eclipse.ui.tests.harness
- META-INF
- src/org/eclipse/ui/tests/harness/util
2 files changed
+60
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 59 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| 131 | + | |
125 | 132 | | |
126 | 133 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
| |||
160 | 164 | | |
161 | 165 | | |
162 | 166 | | |
163 | | - | |
| 167 | + | |
164 | 168 | | |
165 | | - | |
| 169 | + | |
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
| |||
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
193 | 206 | | |
194 | 207 | | |
195 | 208 | | |
| |||
199 | 212 | | |
200 | 213 | | |
201 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
202 | 247 | | |
203 | 248 | | |
204 | 249 | | |
| |||
0 commit comments