Commit | Line | Data |
---|---|---|
b70c55af | 1 | /******************************************************************************* |
edded5c1 | 2 | * Copyright (c) 2015, 2016 Ericsson |
b70c55af MK |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.latency; | |
14 | ||
b6fddb83 MK |
15 | import static org.junit.Assert.assertEquals; |
16 | import static org.junit.Assert.assertNotNull; | |
17 | import static org.junit.Assert.assertNull; | |
18 | import static org.junit.Assert.assertTrue; | |
19 | import static org.junit.Assert.fail; | |
b70c55af | 20 | |
b6fddb83 | 21 | import java.io.BufferedReader; |
37b7faba | 22 | import java.io.ByteArrayOutputStream; |
b6fddb83 MK |
23 | import java.io.File; |
24 | import java.io.FileReader; | |
973f89f2 | 25 | import java.io.IOException; |
37b7faba MK |
26 | import java.lang.reflect.InvocationTargetException; |
27 | import java.lang.reflect.Method; | |
94d1ce7d | 28 | import java.util.ArrayList; |
b6fddb83 | 29 | import java.util.Arrays; |
94d1ce7d MK |
30 | import java.util.List; |
31 | import java.util.Random; | |
b6fddb83 | 32 | import java.util.stream.Collectors; |
94d1ce7d MK |
33 | |
34 | import org.apache.log4j.ConsoleAppender; | |
35 | import org.apache.log4j.Logger; | |
36 | import org.apache.log4j.SimpleLayout; | |
973f89f2 | 37 | import org.eclipse.core.runtime.FileLocator; |
94d1ce7d MK |
38 | import org.eclipse.jdt.annotation.NonNull; |
39 | import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | |
40 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; | |
e92fbda6 | 41 | import org.eclipse.swtbot.swt.finder.SWTBot; |
94d1ce7d | 42 | import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; |
b70c55af | 43 | import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; |
94d1ce7d MK |
44 | import org.eclipse.swtbot.swt.finder.results.BoolResult; |
45 | import org.eclipse.swtbot.swt.finder.results.Result; | |
46 | import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; | |
37b7faba | 47 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; |
94d1ce7d | 48 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; |
37b7faba | 49 | import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableView; |
edded5c1 | 50 | import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer; |
94d1ce7d | 51 | import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.SystemCallLatencyView; |
660d4ed9 | 52 | import org.eclipse.tracecompass.segmentstore.core.BasicSegment; |
973f89f2 | 53 | import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace; |
b6fddb83 MK |
54 | import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; |
55 | import org.eclipse.tracecompass.tmf.ui.dialog.TmfFileDialogFactory; | |
94d1ce7d MK |
56 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; |
57 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils; | |
f0beeb4a | 58 | import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils; |
94d1ce7d MK |
59 | import org.eclipse.ui.IViewPart; |
60 | import org.eclipse.ui.IViewReference; | |
61 | import org.eclipse.ui.PlatformUI; | |
62 | import org.eclipse.ui.WorkbenchException; | |
63 | import org.junit.After; | |
64 | import org.junit.Before; | |
65 | import org.junit.BeforeClass; | |
b8dd6611 | 66 | import org.junit.Ignore; |
b70c55af MK |
67 | import org.junit.Test; |
68 | import org.junit.runner.RunWith; | |
69 | ||
70 | /** | |
71 | * Tests of the latency table | |
94d1ce7d | 72 | * |
b70c55af MK |
73 | * @author Matthew Khouzam |
74 | */ | |
75 | @RunWith(SWTBotJunit4ClassRunner.class) | |
76 | public class SystemCallLatencyTableAnalysisTest { | |
77 | ||
973f89f2 MK |
78 | private static final String TRACE_TYPE = "org.eclipse.linuxtools.lttng2.kernel.tracetype"; |
79 | private static final String PROJECT_NAME = "test"; | |
94d1ce7d MK |
80 | private static final String VIEW_ID = SystemCallLatencyView.ID; |
81 | private static final String TRACING_PERSPECTIVE_ID = "org.eclipse.linuxtools.tmf.ui.perspective"; | |
82 | ||
83 | /** The Log4j logger instance. */ | |
84 | private static final Logger fLogger = Logger.getRootLogger(); | |
85 | private SystemCallLatencyView fLatencyView; | |
86 | private AbstractSegmentStoreTableViewer fTable; | |
87 | ||
88 | /** | |
89 | * Things to setup | |
90 | */ | |
91 | @BeforeClass | |
92 | public static void beforeClass() { | |
93 | ||
94 | SWTBotUtils.initialize(); | |
95 | Thread.currentThread().setName("SWTBotTest"); | |
96 | /* set up for swtbot */ | |
97 | SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */ | |
98 | SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; | |
99 | fLogger.removeAllAppenders(); | |
100 | fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); | |
101 | SWTWorkbenchBot bot = new SWTWorkbenchBot(); | |
102 | final List<SWTBotView> openViews = bot.views(); | |
103 | for (SWTBotView view : openViews) { | |
104 | if (view.getTitle().equals("Welcome")) { | |
105 | view.close(); | |
106 | bot.waitUntil(ConditionHelpers.ViewIsClosed(view)); | |
107 | } | |
108 | } | |
109 | /* Switch perspectives */ | |
110 | switchTracingPerspective(); | |
111 | /* Finish waiting for eclipse to load */ | |
f0beeb4a | 112 | WaitUtils.waitForJobs(); |
94d1ce7d MK |
113 | |
114 | } | |
115 | ||
116 | /** | |
117 | * Opens a latency table | |
118 | */ | |
119 | @Before | |
120 | public void createTable() { | |
121 | /* | |
122 | * Open latency view | |
123 | */ | |
124 | SWTBotUtils.openView(VIEW_ID); | |
125 | SWTWorkbenchBot bot = new SWTWorkbenchBot(); | |
126 | SWTBotView viewBot = bot.viewById(VIEW_ID); | |
127 | final IViewReference viewReference = viewBot.getViewReference(); | |
128 | IViewPart viewPart = UIThreadRunnable.syncExec(new Result<IViewPart>() { | |
129 | @Override | |
130 | public IViewPart run() { | |
131 | return viewReference.getView(true); | |
132 | } | |
133 | }); | |
134 | assertNotNull(viewPart); | |
135 | if (!(viewPart instanceof SystemCallLatencyView)) { | |
136 | fail("Could not instanciate view"); | |
137 | } | |
138 | fLatencyView = (SystemCallLatencyView) viewPart; | |
139 | fTable = fLatencyView.getSegmentStoreViewer(); | |
140 | assertNotNull(fTable); | |
141 | } | |
142 | ||
143 | /** | |
144 | * Closes the view | |
145 | */ | |
146 | @After | |
147 | public void closeTable() { | |
148 | final SWTWorkbenchBot swtWorkbenchBot = new SWTWorkbenchBot(); | |
149 | SWTBotView viewBot = swtWorkbenchBot.viewById(VIEW_ID); | |
150 | viewBot.close(); | |
151 | } | |
152 | ||
153 | private static void switchTracingPerspective() { | |
154 | final Exception retE[] = new Exception[1]; | |
155 | if (!UIThreadRunnable.syncExec(new BoolResult() { | |
156 | @Override | |
157 | public Boolean run() { | |
158 | try { | |
159 | PlatformUI.getWorkbench().showPerspective(TRACING_PERSPECTIVE_ID, | |
160 | PlatformUI.getWorkbench().getActiveWorkbenchWindow()); | |
161 | } catch (WorkbenchException e) { | |
162 | retE[0] = e; | |
163 | return false; | |
164 | } | |
165 | return true; | |
166 | } | |
167 | })) { | |
168 | fail(retE[0].getMessage()); | |
169 | } | |
170 | ||
171 | } | |
172 | ||
173 | /** | |
174 | * Test incrementing | |
175 | */ | |
176 | @Test | |
177 | public void climbTest() { | |
660d4ed9 | 178 | List<@NonNull BasicSegment> fixture = new ArrayList<>(); |
94d1ce7d | 179 | for (int i = 0; i < 100; i++) { |
660d4ed9 | 180 | fixture.add(new BasicSegment(i, 2 * i)); |
94d1ce7d MK |
181 | } |
182 | ||
183 | assertNotNull(fTable); | |
184 | fTable.updateModel(fixture); | |
185 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
e92fbda6 MAL |
186 | SWTBot bot = new SWTBot(); |
187 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
94d1ce7d | 188 | tableBot.header("Duration").click(); |
e92fbda6 | 189 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); |
94d1ce7d | 190 | tableBot.header("Duration").click(); |
e92fbda6 | 191 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); |
94d1ce7d MK |
192 | } |
193 | ||
194 | /** | |
195 | * Test decrementing | |
196 | */ | |
197 | @Test | |
198 | public void decrementingTest() { | |
660d4ed9 | 199 | List<@NonNull BasicSegment> fixture = new ArrayList<>(); |
94d1ce7d | 200 | for (int i = 100; i >= 0; i--) { |
660d4ed9 | 201 | fixture.add(new BasicSegment(i, 2 * i)); |
94d1ce7d MK |
202 | } |
203 | assertNotNull(fTable); | |
204 | fTable.updateModel(fixture); | |
205 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
e92fbda6 MAL |
206 | SWTBot bot = new SWTBot(); |
207 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "100", 0, 2)); | |
94d1ce7d | 208 | tableBot.header("Duration").click(); |
e92fbda6 | 209 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); |
94d1ce7d | 210 | tableBot.header("Duration").click(); |
e92fbda6 | 211 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "100", 0, 2)); |
94d1ce7d MK |
212 | } |
213 | ||
214 | /** | |
215 | * Test small table | |
216 | */ | |
217 | @Test | |
218 | public void smallTest() { | |
660d4ed9 | 219 | List<@NonNull BasicSegment> fixture = new ArrayList<>(); |
94d1ce7d | 220 | for (int i = 1; i >= 0; i--) { |
660d4ed9 | 221 | fixture.add(new BasicSegment(i, 2 * i)); |
94d1ce7d MK |
222 | } |
223 | assertNotNull(fTable); | |
224 | fTable.updateModel(fixture); | |
225 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
e92fbda6 MAL |
226 | SWTBot bot = new SWTBot(); |
227 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); | |
94d1ce7d | 228 | tableBot.header("Duration").click(); |
e92fbda6 | 229 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); |
94d1ce7d | 230 | tableBot.header("Duration").click(); |
e92fbda6 | 231 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); |
94d1ce7d MK |
232 | } |
233 | ||
234 | /** | |
235 | * Test large | |
236 | */ | |
237 | @Test | |
238 | public void largeTest() { | |
239 | final int size = 1000000; | |
660d4ed9 | 240 | BasicSegment[] fixture = new BasicSegment[size]; |
94d1ce7d | 241 | for (int i = 0; i < size; i++) { |
660d4ed9 | 242 | fixture[i] = (new BasicSegment(i, 2 * i)); |
94d1ce7d MK |
243 | } |
244 | assertNotNull(fTable); | |
245 | fTable.updateModel(fixture); | |
246 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
e92fbda6 MAL |
247 | SWTBot bot = new SWTBot(); |
248 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); | |
94d1ce7d | 249 | tableBot.header("Duration").click(); |
e92fbda6 | 250 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); |
94d1ce7d | 251 | tableBot.header("Duration").click(); |
ef47abba | 252 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2)); |
94d1ce7d MK |
253 | } |
254 | ||
255 | /** | |
256 | * Test noise | |
257 | */ | |
258 | @Test | |
259 | public void noiseTest() { | |
260 | Random rnd = new Random(); | |
261 | rnd.setSeed(1234); | |
262 | final int size = 1000000; | |
660d4ed9 | 263 | BasicSegment[] fixture = new BasicSegment[size]; |
94d1ce7d MK |
264 | for (int i = 0; i < size; i++) { |
265 | int start = Math.abs(rnd.nextInt(100000000)); | |
266 | int end = start + Math.abs(rnd.nextInt(1000000)); | |
660d4ed9 | 267 | fixture[i] = (new BasicSegment(start, end)); |
94d1ce7d MK |
268 | } |
269 | assertNotNull(fTable); | |
270 | fTable.updateModel(fixture); | |
271 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
e92fbda6 | 272 | SWTBot bot = new SWTBot(); |
ef47abba | 273 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "894,633", 0, 2)); |
94d1ce7d | 274 | tableBot.header("Duration").click(); |
e92fbda6 | 275 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); |
94d1ce7d | 276 | tableBot.header("Duration").click(); |
ef47abba | 277 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999,999", 0, 2)); |
94d1ce7d MK |
278 | } |
279 | ||
b70c55af | 280 | /** |
94d1ce7d | 281 | * Test gaussian noise |
b70c55af MK |
282 | */ |
283 | @Test | |
94d1ce7d MK |
284 | public void gaussianNoiseTest() { |
285 | Random rnd = new Random(); | |
286 | rnd.setSeed(1234); | |
660d4ed9 | 287 | List<@NonNull BasicSegment> fixture = new ArrayList<>(); |
94d1ce7d MK |
288 | for (int i = 1; i <= 1000000; i++) { |
289 | int start = Math.abs(rnd.nextInt(100000000)); | |
290 | final int delta = Math.abs(rnd.nextInt(1000)); | |
291 | int end = start + delta * delta; | |
660d4ed9 | 292 | fixture.add(new BasicSegment(start, end)); |
94d1ce7d MK |
293 | } |
294 | assertNotNull(fTable); | |
295 | fTable.updateModel(fixture); | |
296 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
e92fbda6 | 297 | SWTBot bot = new SWTBot(); |
ef47abba | 298 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "400,689", 0, 2)); |
94d1ce7d | 299 | tableBot.header("Duration").click(); |
e92fbda6 | 300 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); |
94d1ce7d | 301 | tableBot.header("Duration").click(); |
ef47abba | 302 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "998,001", 0, 2)); |
b70c55af MK |
303 | } |
304 | ||
37b7faba MK |
305 | /** |
306 | * Test creating a tsv | |
307 | * | |
308 | * @throws NoSuchMethodException | |
309 | * Error creating the tsv | |
b6fddb83 MK |
310 | * @throws IOException |
311 | * no such file or the file is locked. | |
37b7faba | 312 | */ |
b8dd6611 | 313 | @Ignore |
37b7faba | 314 | @Test |
b6fddb83 MK |
315 | public void testWriteToTsv() throws NoSuchMethodException, IOException { |
316 | ||
37b7faba MK |
317 | List<@NonNull BasicSegment> fixture = new ArrayList<>(); |
318 | for (int i = 1; i <= 20; i++) { | |
319 | int start = i; | |
320 | final int delta = i; | |
321 | int end = start + delta * delta; | |
322 | fixture.add(new BasicSegment(start, end)); | |
323 | } | |
324 | assertNotNull(fTable); | |
325 | fTable.updateModel(fixture); | |
326 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); | |
327 | SWTBot bot = new SWTBot(); | |
328 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2)); | |
329 | SWTWorkbenchBot swtWorkbenchBot = new SWTWorkbenchBot(); | |
330 | SWTBotView viewBot = swtWorkbenchBot.viewById(VIEW_ID); | |
b6fddb83 MK |
331 | List<String> actionResult = Arrays.asList(testToTsv(viewBot)); |
332 | String absolutePath = TmfTraceManager.getTemporaryDirPath() + File.separator + "syscallLatencyTest.testWriteToTsv.tsv"; | |
333 | TmfFileDialogFactory.setOverrideFiles(absolutePath); | |
37b7faba | 334 | SWTBotMenu menuBot = viewBot.viewMenu().menu("Export to TSV"); |
b6fddb83 MK |
335 | try { |
336 | assertTrue(menuBot.isEnabled()); | |
337 | assertTrue(menuBot.isVisible()); | |
338 | menuBot.click(); | |
339 | ||
340 | try (BufferedReader br = new BufferedReader(new FileReader(absolutePath))) { | |
341 | List<String> lines = br.lines().collect(Collectors.toList()); | |
342 | assertEquals("Both reads", actionResult, lines); | |
343 | } | |
344 | } finally { | |
345 | new File(absolutePath).delete(); | |
346 | } | |
347 | ||
37b7faba MK |
348 | } |
349 | ||
b6fddb83 | 350 | private String[] testToTsv(SWTBotView view) throws NoSuchMethodException { |
37b7faba MK |
351 | ByteArrayOutputStream os = new ByteArrayOutputStream(); |
352 | assertNotNull(os); | |
353 | Class<@NonNull AbstractSegmentStoreTableView> clazz = AbstractSegmentStoreTableView.class; | |
354 | Method method = clazz.getDeclaredMethod("exportToTsv", java.io.OutputStream.class); | |
355 | method.setAccessible(true); | |
356 | final Exception[] except = new Exception[1]; | |
357 | UIThreadRunnable.syncExec(() -> { | |
358 | try { | |
359 | method.invoke(fLatencyView, os); | |
360 | } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { | |
361 | except[0] = e; | |
362 | } | |
363 | }); | |
364 | assertNull(except[0]); | |
365 | @SuppressWarnings("null") | |
366 | String[] lines = String.valueOf(os).split(System.getProperty("line.separator")); | |
367 | assertNotNull(lines); | |
368 | assertEquals("number of lines", 21, lines.length); | |
369 | assertEquals("header", "Start Time\tEnd Time\tDuration", lines[0]); | |
b6fddb83 MK |
370 | // not a straight up string compare due to time zones. Kathmandu and |
371 | // Eucla have 15 minute time zones. | |
37b7faba | 372 | assertTrue("line 1", lines[1].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s001\\t\\d\\d:\\d\\d:00.000 000 002\\t1")); |
5e5db534 MK |
373 | assertTrue("line 2", lines[2].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s002\\t\\d\\d:\\d\\d:00.000 000 006\\t4")); |
374 | assertTrue("line 3", lines[3].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s003\\t\\d\\d:\\d\\d:00.000 000 012\\t9")); | |
375 | assertTrue("line 4", lines[4].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s004\\t\\d\\d:\\d\\d:00.000 000 020\\t16")); | |
376 | assertTrue("line 5", lines[5].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s005\\t\\d\\d:\\d\\d:00.000 000 030\\t25")); | |
377 | assertTrue("line 6", lines[6].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s006\\t\\d\\d:\\d\\d:00.000 000 042\\t36")); | |
378 | assertTrue("line 7", lines[7].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s007\\t\\d\\d:\\d\\d:00.000 000 056\\t49")); | |
379 | assertTrue("line 8", lines[8].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s008\\t\\d\\d:\\d\\d:00.000 000 072\\t64")); | |
380 | assertTrue("line 9", lines[9].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s009\\t\\d\\d:\\d\\d:00.000 000 090\\t81")); | |
381 | assertTrue("line 10", lines[10].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s010\\t\\d\\d:\\d\\d:00.000 000 110\\t100")); | |
382 | assertTrue("line 11", lines[11].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s011\\t\\d\\d:\\d\\d:00.000 000 132\\t121")); | |
383 | assertTrue("line 12", lines[12].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s012\\t\\d\\d:\\d\\d:00.000 000 156\\t144")); | |
384 | assertTrue("line 13", lines[13].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s013\\t\\d\\d:\\d\\d:00.000 000 182\\t169")); | |
385 | assertTrue("line 14", lines[14].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s014\\t\\d\\d:\\d\\d:00.000 000 210\\t196")); | |
386 | assertTrue("line 15", lines[15].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s015\\t\\d\\d:\\d\\d:00.000 000 240\\t225")); | |
387 | assertTrue("line 16", lines[16].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s016\\t\\d\\d:\\d\\d:00.000 000 272\\t256")); | |
388 | assertTrue("line 17", lines[17].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s017\\t\\d\\d:\\d\\d:00.000 000 306\\t289")); | |
389 | assertTrue("line 18", lines[18].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s018\\t\\d\\d:\\d\\d:00.000 000 342\\t324")); | |
390 | assertTrue("line 19", lines[19].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s019\\t\\d\\d:\\d\\d:00.000 000 380\\t361")); | |
391 | assertTrue("line 20", lines[20].matches("\\d\\d:\\d\\d:00\\.000\\s000\\s020\\t\\d\\d:\\d\\d:00.000 000 420\\t400")); | |
b6fddb83 | 392 | return lines; |
37b7faba MK |
393 | } |
394 | ||
973f89f2 MK |
395 | /** |
396 | * Test with an actual trace, this is more of an integration test than a | |
397 | * unit test. This test is a slow one too. If some analyses are not well | |
398 | * configured, this test will also generates null pointer exceptions. These | |
399 | * are will be logged. | |
400 | * | |
401 | * @throws IOException | |
402 | * trace not found? | |
403 | */ | |
404 | @Test | |
405 | public void testWithTrace() throws IOException { | |
406 | String tracePath; | |
407 | tracePath = FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).getPath(); | |
408 | SWTWorkbenchBot bot = new SWTWorkbenchBot(); | |
409 | SWTBotView view = bot.viewById(VIEW_ID); | |
410 | view.close(); | |
411 | bot.waitUntil(ConditionHelpers.ViewIsClosed(view)); | |
412 | SWTBotUtils.createProject(PROJECT_NAME); | |
413 | SWTBotUtils.openTrace(PROJECT_NAME, tracePath, TRACE_TYPE); | |
f0beeb4a | 414 | WaitUtils.waitForJobs(); |
973f89f2 | 415 | createTable(); |
f0beeb4a | 416 | WaitUtils.waitForJobs(); |
973f89f2 | 417 | SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable()); |
ef47abba | 418 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "24,100", 0, 2)); |
973f89f2 | 419 | tableBot.header("Duration").click(); |
ef47abba | 420 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1,000", 0, 2)); |
973f89f2 | 421 | tableBot.header("Duration").click(); |
ef47abba | 422 | bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "5,904,091,700", 0, 2)); |
973f89f2 MK |
423 | bot.closeAllEditors(); |
424 | SWTBotUtils.deleteProject(PROJECT_NAME, bot); | |
425 | } | |
b70c55af | 426 | } |