gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ust.core.tests / src / org / eclipse / linuxtools / lttng2 / ust / core / tests / trace / callstack / LttngUstCallStackProviderFastTest.java
index 06a2196566963c13eb417fcbda2a962a66bf91b9..fccfd93ec2781f7a9d7d7a123b2b6101feb3a88b 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
 
 package org.eclipse.linuxtools.lttng2.ust.core.tests.trace.callstack;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
-import java.io.File;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.linuxtools.lttng2.ust.core.trace.LttngUstTrace;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.statesystem.ITmfStateSystem;
-import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.linuxtools.tmf.core.trace.TmfTraceManager;
-import org.junit.AfterClass;
+import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.junit.BeforeClass;
-import org.junit.Test;
 
 /**
  * Test suite for the UST callstack state provider, using the trace of a program
@@ -38,128 +24,33 @@ import org.junit.Test;
  *
  * @author Alexandre Montplaisir
  */
-public class LttngUstCallStackProviderFastTest {
-
-    // ------------------------------------------------------------------------
-    // Attributes
-    // ------------------------------------------------------------------------
-
-    private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.CYG_PROFILE_FAST;
-
-    private static final String PROCNAME = "glxgears-29822";
-
-    private static LttngUstTrace fixture = null;
+public class LttngUstCallStackProviderFastTest extends AbstractProviderTest {
 
-    // ------------------------------------------------------------------------
-    // Class  methods
-    // ------------------------------------------------------------------------
+    private static final long[] timestamps = { 1379361250310000000L,
+                                               1379361250498400000L,
+                                               1379361250499759000L };
 
     /**
-     * Perform pre-class initialization.
-     *
-     * @throws TmfTraceException
-     *             If the test trace is not found
+     * Class setup
      */
     @BeforeClass
-    public static void setUp() throws TmfTraceException {
-        assumeTrue(testTrace.exists());
-
-        /* We init the trace ourselves (we need the specific LttngUstTrace type) */
-        fixture = new LttngUstTrace();
-        IStatus valid = fixture.validate(null, testTrace.getPath());
-        assertTrue(valid.isOK());
-        fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
-        TestUtils.openTrace(fixture);
+    public static void setUpClass() {
+        assumeTrue(CtfTmfTestTrace.CYG_PROFILE_FAST.exists());
     }
 
-    /**
-     * Perform post-class clean-up.
-     */
-    @AfterClass
-    public static void tearDown() {
-        if (fixture != null) {
-            fixture.dispose();
-            File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(fixture));
-            TestUtils.deleteDirectory(suppDir);
-        }
+    @Override
+    protected CtfTmfTestTrace getTestTrace() {
+        return CtfTmfTestTrace.CYG_PROFILE_FAST;
     }
 
-    // ------------------------------------------------------------------------
-    // Test methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Test that the callstack state system is there and contains data.
-     */
-    @Test
-    public void testConstruction() {
-        ITmfStateSystem ss = fixture.getStateSystems().get(TestUtils.SSID);
-        assertNotNull(ss);
-        assertTrue(ss.getNbAttributes() > 0);
+    @Override
+    protected String getProcName() {
+        return "glxgears-29822";
     }
 
-    /**
-     * Test the callstack at the beginning of the state system.
-     */
-    @Test
-    public void testCallStackBegin() {
-        long start = fixture.getStateSystems().get(TestUtils.SSID).getStartTime();
-        String[] cs = TestUtils.getCallStack(fixture, PROCNAME, start);
-        assertEquals(1, cs.length);
-
-        assertEquals("40472b", cs[0]);
+    @Override
+    protected long getTestTimestamp(int index) {
+        return timestamps[index];
     }
 
-    /**
-     * Test the callstack somewhere in the trace.
-     */
-    @Test
-    public void testCallStack1() {
-        String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1379361250310000000L);
-        assertEquals(2, cs.length);
-
-        assertEquals("40472b", cs[0]);
-        assertEquals("403d60", cs[1]);
-    }
-
-    /**
-     * Test the callstack somewhere in the trace.
-     */
-    @Test
-    public void testCallStack2() {
-        String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1379361250498400000L);
-        assertEquals(3, cs.length);
-
-        assertEquals("40472b", cs[0]);
-        assertEquals("403b14", cs[1]);
-        assertEquals("401b23", cs[2]);
-    }
-
-    /**
-     * Test the callstack somewhere in the trace.
-     */
-    @Test
-    public void testCallStack3() {
-        String[] cs = TestUtils.getCallStack(fixture, PROCNAME, 1379361250499759000L);
-        assertEquals(4, cs.length);
-
-        assertEquals("40472b", cs[0]);
-        assertEquals("4045c8", cs[1]);
-        assertEquals("403760", cs[2]);
-        assertEquals("401aac", cs[3]);
-    }
-
-    /**
-     * Test the callstack at the end of the trace/state system.
-     */
-    @Test
-    public void testCallStackEnd() {
-        long end = fixture.getStateSystems().get(TestUtils.SSID).getCurrentEndTime();
-        String[] cs = TestUtils.getCallStack(fixture, PROCNAME, end);
-        assertEquals(3, cs.length);
-
-        assertEquals("40472b", cs[0]);
-        assertEquals("4045c8", cs[1]);
-        assertEquals("403760", cs[2]);
-    }
-}
+}
\ No newline at end of file
This page took 0.028108 seconds and 5 git commands to generate.