Search in sources :

Example 1 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class ControlFlowViewTest method testFilter.

/**
 * Test the filter
 */
@Test
public void testFilter() {
    /* change window range to 1 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(1000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    SWTBotView viewBot = getViewBot();
    SWTBotToolbarButton filterButton = viewBot.toolbarButton("Show View Filters");
    filterButton.click();
    SWTBot bot = fBot.shell("Filter").activate().bot();
    SWTBotTree treeBot = bot.tree();
    // get how many items there are
    int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("default", 226, checked);
    // test "uncheck all button"
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    // test check active
    bot.button(CHECK_ACTIVE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_ACTIVE, 69, checked);
    // test check all
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_ALL, 226, checked);
    // test uncheck inactive
    bot.button(UNCHECK_INACTIVE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_INACTIVE, 69, checked);
    // test check selected
    treeBot.getTreeItem(LttngTraceGenerator.getName()).select("gnuplot");
    bot.button(UNCHECK_ALL).click();
    bot.button(CHECK_SELECTED).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_SELECTED, 2, checked);
    // test check subtree
    bot.button(UNCHECK_ALL).click();
    bot.button(CHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(CHECK_SUBTREE, 2, checked);
    // test uncheck selected
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SELECTED).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 225, checked);
    // test uncheck subtree
    bot.button(CHECK_ALL).click();
    bot.button(UNCHECK_SUBTREE).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(UNCHECK_SELECTED, 225, checked);
    // test filter
    bot.button(UNCHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals(0, checked);
    bot.text().setText("half-life 3");
    SWTBotTreeItem treeItem = treeBot.getTreeItem(LttngTraceGenerator.getName());
    treeItem.rowCount();
    fBot.waitUntil(ConditionHelpers.treeItemCount(treeItem, 25));
    bot.button(CHECK_ALL).click();
    checked = SWTBotUtils.getTreeCheckedItemCount(treeBot);
    assertEquals("Filtered", 26, checked);
    bot.button(DIALOG_OK).click();
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    for (SWTBotTimeGraphEntry entry : traceEntry.getEntries()) {
        assertEquals("Filtered Control flow view", "Half-life 3", entry.getText());
    }
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotToolbarButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton) Test(org.junit.Test)

Example 2 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class CriticalPathTest method testFull.

/**
 * test the behavior of the critical path for a thread selection signal from
 * the control flow view
 */
@Test
public void testFull() {
    SWTBotTimeGraph timeGraphCfv = new SWTBotTimeGraph(fViewBotCfv.bot());
    SWTBotTree treeCp = fViewBotCp.bot().tree();
    SWTBotTimeGraph timeGraphCp = new SWTBotTimeGraph(fViewBotCp.bot());
    assertNotNull(timeGraphCfv.widget);
    assertNotNull(treeCp.widget);
    SWTBotTreeItem[] allItems = treeCp.getAllItems();
    for (int i = 0; i < allItems.length; i++) {
        assertEquals(0, allItems[i].getNodes().size());
    }
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    assertNotNull(trace);
    SWTBotTimeGraphEntry entry = timeGraphCfv.getEntry(trace.getName(), "systemd", "we", PROCESS);
    assertNotNull(entry);
    entry.select();
    SWTBotMenu menu = entry.contextMenu("Follow " + PROCESS + "/" + TID);
    assertEquals("Follow " + PROCESS + "/" + TID, menu.getText());
    menu.click();
    fBot.waitUntil(new DefaultCondition() {

        @Override
        public boolean test() throws Exception {
            SWTBotTimeGraphEntry[] entries = timeGraphCp.getEntries();
            return CRIT_PATH_MAIN_ENTRY.equals(entries[0].getEntries()[0].getText());
        }

        @Override
        public String getFailureMessage() {
            return "Could not find " + CRIT_PATH_MAIN_ENTRY + " in Critical Path view";
        }
    });
    // Test navigating the critical path view with the follow arrows buttons
    IWorkbenchPart part = fViewBotCp.getViewReference().getPart(false);
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, CPU_TIME0));
    SWTBotTimeGraphEntry critPathEntry = timeGraphCp.getEntry(trace.getHostId(), CRIT_PATH_MAIN_ENTRY);
    critPathEntry.select();
    // Condition to wait for the time graph view to refresh
    ICondition timeGraphIsReadyCondition = ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, new TmfTimeRange(CPU_TIME1, CPU_TIME1), CPU_TIME1);
    // Reach the end of the current event
    fViewBotCp.toolbarButton(FOLLOW_FORWARD).click();
    fBot.waitUntil(timeGraphIsReadyCondition);
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCp, 0, CRIT_PATH_MAIN_ENTRY));
    // Follow the arrow down to the next item
    fViewBotCp.toolbarButton(FOLLOW_FORWARD).click();
    fBot.waitUntil(timeGraphIsReadyCondition);
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCp, 0, CRIT_PATH_OTHER_ENTRY));
    // Make sure changing the selection changed the selection in CFV too
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCfv, 0, KWORKER_PROCESS));
    // Follow it back up
    fViewBotCp.toolbarButton(FOLLOW_BACKWARD).click();
    fBot.waitUntil(timeGraphIsReadyCondition);
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCp, 0, CRIT_PATH_MAIN_ENTRY));
    // Make sure changing the selection changed the selection in CFV too
    fBot.waitUntil(ConditionHelpers.timeGraphSelectionContains(timeGraphCfv, 0, PROCESS));
    // Follow another process and make sure the critical path changes
    entry = timeGraphCfv.getEntry(trace.getName(), "systemd", "we", PROCESS, PROCESS2);
    assertNotNull(entry);
    entry.select();
    menu = entry.contextMenu("Follow " + PROCESS2 + "/" + TID2);
    assertEquals("Follow " + PROCESS2 + "/" + TID2, menu.getText());
    menu.click();
    fBot.waitUntil(new DefaultCondition() {

        @Override
        public boolean test() throws Exception {
            SWTBotTimeGraphEntry[] entries = timeGraphCp.getEntries();
            return CRIT_PATH_MAIN_ENTRY2.equals(entries[0].getEntries()[0].getText());
        }

        @Override
        public String getFailureMessage() {
            return "Could not find " + CRIT_PATH_MAIN_ENTRY2 + " in Critical Path view";
        }
    });
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) IOException(java.io.IOException) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotTreeItem(org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem) DefaultCondition(org.eclipse.swtbot.swt.finder.waits.DefaultCondition) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) ICondition(org.eclipse.swtbot.swt.finder.waits.ICondition) Test(org.junit.Test)

Example 3 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class FlameChartViewTest method testGoToTimeAndCheckStackWithNames.

/**
 * Test check callstack at a time with function map
 *
 * @throws IOException
 *             Missing file
 */
@Test
public void testGoToTimeAndCheckStackWithNames() throws IOException {
    goToTime(TIMESTAMPS[0]);
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();
    URL mapUrl = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt");
    String absoluteFile = FileLocator.toFileURL(mapUrl).getFile();
    TmfFileDialogFactory.setOverrideFiles(absoluteFile);
    SWTBotShell shell = openSymbolProviderDialog();
    SWTBot shellBot = shell.bot();
    shellBot.button("Add...").click();
    shellBot.button("OK").click();
    shellBot.waitUntil(Conditions.shellCloses(shell));
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    SWTBotTimeGraphEntry[] threads = timeGraph.getEntry(TRACE, PROCESS).getEntries();
    assertEquals(1, threads.length);
    assertEquals(THREAD, threads[0].getText(0));
    waitForSymbolNames("main", "event_loop", "handle_event");
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) URL(java.net.URL) Test(org.junit.Test)

Example 4 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class ControlFlowViewSortingTest method testColumnSorting.

// ------------------------------------------------------------------------
// Test case(s)
// ------------------------------------------------------------------------
/**
 * UI test of sorting of processes in CFV based on column selection. To verify that the sorting
 * was executed correctly, the test will use bot.waitUntil() the column content has the right
 * order.
 */
@Test
public void testColumnSorting() {
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(TRACE_START_TIME, TRACE_START_TIME), TRACE_START_TIME));
    // Create a known state
    applyFilter();
    final SWTBotTree tree = fViewBot.bot().tree();
    final SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(fViewBot.bot());
    final SWTBotTimeGraphEntry timeGraphEntry = timeGraph.getEntry(TRACE_NAME, SYSTEMD_PROCESS_NAME);
    timeGraphEntry.select();
    testProcessSorting(tree, timeGraph);
    testTidSorting(tree, timeGraph);
    testPidSorting(tree, timeGraph);
    testPtidSorting(tree, timeGraph);
    testBirthtimeSorting(tree, timeGraph);
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 5 with SWTBotTimeGraphEntry

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry in project tracecompass by tracecompass.

the class ControlFlowViewTest method testDynamicFilteringCpu.

/**
 * Test dynamic filters dialog on CPU
 */
@Test
public void testDynamicFilteringCpu() {
    /* Change window range to 10 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot());
    SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName());
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 225, traceEntry, () -> "Entries size expected:225 actual:" + traceEntry.getEntries().length);
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    SWTBotShell shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    /* Make sure nothing is checked and radio buttons are disabled */
    SWTBotCheckBox activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    assertFalse(activeThreadsCheckbox.isChecked());
    SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO);
    SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE);
    /* Toggle active thread filter button */
    activeThreadsCheckbox.click();
    assertTrue(activeThreadsCheckbox.isChecked());
    /* Filter on selected CPUs */
    onCpuRadio.click();
    onCpuField.setText("0");
    shell.bot().button(DIALOG_OK).click();
    /*
         * A zoom thread is started after applying the filter. Make sure that the time graph
         * is ready before continuing with the test
         */
    timeGraphIsReadyCondition(range);
    /* Change window range to 50 us */
    range = new TmfTimeRange(START_TIME, START_TIME.normalize(50000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime()));
    timeGraphIsReadyCondition(range);
    /* Verify that number active entries changed */
    SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 1, traceEntry, () -> "Entries size expected:1 actual:" + traceEntry.getEntries().length);
    getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click();
    shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate();
    activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX);
    assertTrue(activeThreadsCheckbox.isChecked());
    /*
         * Test Active Filter buttons toggle
         */
    activeThreadsCheckbox.click();
    /* All objects should be enabled except for the CPU ranges field */
    assertFalse(activeThreadsCheckbox.isChecked());
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotCheckBox(org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Aggregations

SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)14 SWTBotTimeGraphEntry (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry)14 Test (org.junit.Test)12 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)6 Point (org.eclipse.swt.graphics.Point)4 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)4 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)3 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)3 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)3 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)2 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)2 SWTBotCheckBox (org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox)2 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)2 ITimeDataProvider (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 IOException (java.io.IOException)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1