| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2016 École Polytechnique de Montréal |
| 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 | |
| 10 | package org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests.perf; |
| 11 | |
| 12 | import java.io.IOException; |
| 13 | import java.util.EnumSet; |
| 14 | |
| 15 | import org.eclipse.core.runtime.FileLocator; |
| 16 | import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; |
| 17 | import org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.perf.views.UiResponseTest; |
| 18 | import org.eclipse.tracecompass.internal.lttng2.kernel.ui.views.PerspectiveFactory; |
| 19 | import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace; |
| 20 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils; |
| 21 | import org.junit.Test; |
| 22 | import org.junit.runner.RunWith; |
| 23 | |
| 24 | /** |
| 25 | * Test the responsiveness of Control Flow View and Resources View for different |
| 26 | * traces and scenarios. Ideally, when running this test, JUL logging should be |
| 27 | * enabled using a logger.properties file. LTTng JUL handler is advised since it |
| 28 | * works better with multi-threaded applications than other log handlers |
| 29 | * |
| 30 | * @author Geneviève Bastien |
| 31 | */ |
| 32 | @RunWith(SWTBotJunit4ClassRunner.class) |
| 33 | public class LttngUiResponseTest extends UiResponseTest { |
| 34 | |
| 35 | private static final String TRACE_TYPE = "org.eclipse.linuxtools.lttng2.kernel.tracetype"; |
| 36 | |
| 37 | @Override |
| 38 | protected void prepareWorkspace() { |
| 39 | /* Switch to kernel perspective */ |
| 40 | SWTBotUtils.switchToPerspective(PerspectiveFactory.ID); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Test with the django trace |
| 45 | * |
| 46 | * @throws SecurityException |
| 47 | * If a security manager is present and any the wrong class is |
| 48 | * loaded or the class loader is not the same as its ancestor's |
| 49 | * loader. |
| 50 | * @throws IllegalArgumentException |
| 51 | * the object is not the correct class type |
| 52 | * @throws IOException |
| 53 | * Exceptions with the trace file |
| 54 | */ |
| 55 | @Test |
| 56 | public void testWithDjango() throws SecurityException, IllegalArgumentException, IOException { |
| 57 | runTestWithTrace(FileLocator.toFileURL(CtfTestTrace.DJANGO_CLIENT.getTraceURL()).getPath(), TRACE_TYPE, EnumSet.allOf(OsLinuxViews.class)); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Test with the many-threads trace |
| 62 | * |
| 63 | * @throws SecurityException |
| 64 | * If a security manager is present and any the wrong class is |
| 65 | * loaded or the class loader is not the same as its ancestor's |
| 66 | * loader. |
| 67 | * @throws IllegalArgumentException |
| 68 | * the object is not the correct class type |
| 69 | * @throws IOException |
| 70 | * Exceptions with the trace file |
| 71 | * |
| 72 | */ |
| 73 | @Test |
| 74 | public void testWithManyThreads() throws SecurityException, IllegalArgumentException, IOException { |
| 75 | runTestWithTrace(FileLocator.toFileURL(CtfTestTrace.MANY_THREADS.getTraceURL()).getPath(), TRACE_TYPE, EnumSet.of(OsLinuxViews.CONTROL_FLOW, OsLinuxViews.RESOURCES, OsLinuxViews.CPU_USAGE, OsLinuxViews.DISK_IO_ACTIVITY)); |
| 76 | } |
| 77 | |
| 78 | } |