Search in sources :

Example 1 with PerfVersion

use of org.eclipse.linuxtools.internal.perf.PerfVersion in project linuxtools by eclipse.

the class PerfVersionTest method testIsNewer.

@Test
public void testIsNewer() {
    PerfVersion version = new PerfVersion("4.2.3.300.fc23.x86_64.g21b8");
    assertTrue(version.isNewer(new PerfVersion(4, 2, 2)));
    assertFalse(version.isNewer(new PerfVersion(4, 2, 4)));
    assertTrue(version.isNewer(new PerfVersion(4, 1, 3)));
    assertFalse(version.isNewer(new PerfVersion(4, 2, 3)));
    assertTrue(version.isNewer(new PerfVersion(3, 2, 3)));
    assertFalse(version.isNewer(new PerfVersion(5, 2, 3)));
}
Also used : PerfVersion(org.eclipse.linuxtools.internal.perf.PerfVersion) Test(org.junit.Test)

Example 2 with PerfVersion

use of org.eclipse.linuxtools.internal.perf.PerfVersion in project linuxtools by eclipse.

the class PerfVersionTest method testPerfVersionIntIntInt.

@Test
public void testPerfVersionIntIntInt() {
    PerfVersion version = new PerfVersion(4, 2, 3);
    assertEquals(4, version.getMajor());
    assertEquals(2, version.getMinor());
    assertEquals(3, version.getMicro());
    assertEquals("", version.getQualifier());
    version = new PerfVersion("4.0.8-200.fc21.x86_64");
    assertEquals(4, version.getMajor());
    assertEquals(0, version.getMinor());
    assertEquals(8, version.getMicro());
    assertEquals("200.fc21.x86_64", version.getQualifier());
    version = new PerfVersion("4.0.8");
    assertEquals(4, version.getMajor());
    assertEquals(0, version.getMinor());
    assertEquals(8, version.getMicro());
    assertEquals("", version.getQualifier());
}
Also used : PerfVersion(org.eclipse.linuxtools.internal.perf.PerfVersion) Test(org.junit.Test)

Example 3 with PerfVersion

use of org.eclipse.linuxtools.internal.perf.PerfVersion in project linuxtools by eclipse.

the class PerfOptionsTab method toggleButtonsEnablement.

/**
 * Toggle enablement of all buttons, excluding the stat button.
 * @param enable enablement of buttons
 */
private void toggleButtonsEnablement(boolean enable) {
    PerfVersion version = PerfCore.getPerfVersion(lastConfig);
    txtKernelLocation.setEnabled(enable);
    chkRecordRealtime.setEnabled(enable);
    chkRecordVerbose.setEnabled(enable);
    chkSourceLineNumbers.setEnabled(enable);
    chkKernelSourceLineNumbers.setEnabled(enable);
    if (version != null && multiplexEventsVersion.isNewer(version)) {
        chkMultiplexEvents.setEnabled(enable);
    } else {
        chkMultiplexEvents.setEnabled(false);
    }
    chkModuleSymbols.setEnabled(enable);
    chkHideUnresolvedSymbols.setEnabled(enable);
    chkShowSourceDisassembly.setEnabled(enable);
}
Also used : PerfVersion(org.eclipse.linuxtools.internal.perf.PerfVersion)

Example 4 with PerfVersion

use of org.eclipse.linuxtools.internal.perf.PerfVersion in project linuxtools by eclipse.

the class LaunchTabsTest method testOptionsTab.

@Test
public void testOptionsTab() throws CoreException {
    ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
    TestOptionsTab tab = new TestOptionsTab();
    tab.createControl(new Shell());
    assertNotNull(tab.getImage());
    assertNotNull(tab.getName());
    // default config
    tab.setDefaults(wc);
    tab.initializeFrom(config);
    assertTrue(tab.isValid(config));
    Button rrCheck = tab.getChkRecordRealtime();
    rrCheck.setSelection(true);
    rrCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(true, config.getAttribute(PerfPlugin.ATTR_Record_Realtime, false));
    rrCheck.setSelection(false);
    rrCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(false, config.getAttribute(PerfPlugin.ATTR_Record_Realtime, true));
    Button rvCheck = tab.getChkRecordVerbose();
    rvCheck.setSelection(true);
    rvCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(true, config.getAttribute(PerfPlugin.ATTR_Record_Verbose, false));
    rvCheck.setSelection(false);
    rvCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(false, config.getAttribute(PerfPlugin.ATTR_Record_Verbose, true));
    Button slcCheck = tab.getChkSourceLineNumbers();
    slcCheck.setSelection(true);
    slcCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(true, config.getAttribute(PerfPlugin.ATTR_SourceLineNumbers, false));
    slcCheck.setSelection(false);
    slcCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(false, config.getAttribute(PerfPlugin.ATTR_SourceLineNumbers, true));
    Button kslcCheck = tab.getChkKernelSourceLineNumbers();
    kslcCheck.setSelection(true);
    kslcCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(true, config.getAttribute(PerfPlugin.ATTR_Kernel_SourceLineNumbers, false));
    kslcCheck.setSelection(false);
    kslcCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(false, config.getAttribute(PerfPlugin.ATTR_Kernel_SourceLineNumbers, true));
    PerfVersion version = PerfCore.getPerfVersion(config);
    Button meCheck = tab.getChkMultiplexEvents();
    if (meCheck.isEnabled()) {
        assertTrue(version != null && new PerfVersion(2, 6, 35).isNewer(version));
        meCheck.setSelection(true);
        meCheck.notifyListeners(SWT.Selection, null);
        performApply(tab, wc);
        assertEquals(true, config.getAttribute(PerfPlugin.ATTR_Multiplex, false));
        meCheck.setSelection(false);
        meCheck.notifyListeners(SWT.Selection, null);
        performApply(tab, wc);
        assertEquals(false, config.getAttribute(PerfPlugin.ATTR_Multiplex, true));
    } else {
        assertTrue(version == null || !new PerfVersion(2, 6, 35).isNewer(version));
    }
    Button msCheck = tab.getChkModuleSymbols();
    msCheck.setSelection(true);
    msCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(true, config.getAttribute(PerfPlugin.ATTR_ModuleSymbols, false));
    msCheck.setSelection(false);
    msCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(false, config.getAttribute(PerfPlugin.ATTR_ModuleSymbols, true));
    Button husCheck = tab.getChkHideUnresolvedSymbols();
    husCheck.setSelection(true);
    husCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(true, config.getAttribute(PerfPlugin.ATTR_HideUnresolvedSymbols, false));
    husCheck.setSelection(false);
    husCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertEquals(false, config.getAttribute(PerfPlugin.ATTR_HideUnresolvedSymbols, true));
    rrCheck.setSelection(true);
    rrCheck.notifyListeners(SWT.Selection, null);
    rvCheck.setSelection(true);
    rvCheck.notifyListeners(SWT.Selection, null);
    slcCheck.setSelection(true);
    slcCheck.notifyListeners(SWT.Selection, null);
    kslcCheck.setSelection(true);
    kslcCheck.notifyListeners(SWT.Selection, null);
    meCheck.setSelection(true);
    meCheck.notifyListeners(SWT.Selection, null);
    msCheck.setSelection(true);
    msCheck.notifyListeners(SWT.Selection, null);
    husCheck.setSelection(true);
    husCheck.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    tab.initializeFrom(config);
    assertTrue(rrCheck.getSelection());
    assertTrue(rvCheck.getSelection());
    assertTrue(slcCheck.getSelection());
    assertTrue(kslcCheck.getSelection());
    assertTrue(meCheck.getSelection());
    assertTrue(msCheck.getSelection());
    assertTrue(husCheck.getSelection());
    Text klocText = tab.getTxtKernelLocation();
    // $NON-NLS-1$
    klocText.setText("doesntexist");
    klocText.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertFalse(tab.isValid(config));
    // $NON-NLS-1$
    klocText.setText("");
    klocText.notifyListeners(SWT.Selection, null);
    performApply(tab, wc);
    assertTrue(tab.isValid(config));
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Button(org.eclipse.swt.widgets.Button) Text(org.eclipse.swt.widgets.Text) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) PerfVersion(org.eclipse.linuxtools.internal.perf.PerfVersion) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 5 with PerfVersion

use of org.eclipse.linuxtools.internal.perf.PerfVersion in project linuxtools by eclipse.

the class PerfVersionTest method testToString.

@Test
public void testToString() {
    String versionString = "4.2.3.300.fc23.x86_64.g21b8";
    PerfVersion version = new PerfVersion(versionString);
    assertTrue(versionString.equals(version.toString()));
}
Also used : PerfVersion(org.eclipse.linuxtools.internal.perf.PerfVersion) Test(org.junit.Test)

Aggregations

PerfVersion (org.eclipse.linuxtools.internal.perf.PerfVersion)8 Test (org.junit.Test)5 CoreException (org.eclipse.core.runtime.CoreException)1 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)1 AbstractTest (org.eclipse.linuxtools.profiling.tests.AbstractTest)1 Point (org.eclipse.swt.graphics.Point)1 Button (org.eclipse.swt.widgets.Button)1 Shell (org.eclipse.swt.widgets.Shell)1 Text (org.eclipse.swt.widgets.Text)1