Increase timeouts for tests that have low values
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.ust.core.tests / src / org / eclipse / tracecompass / lttng2 / ust / core / tests / callstack / AbstractProviderTest.java
index 29a4821cd73a4278416a2fd389a75803feadd916..dab697e75bf9e6359e7051c94c248f18ea451a05 100644 (file)
@@ -23,6 +23,7 @@ import java.io.File;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackProvider;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
 import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
@@ -30,12 +31,12 @@ import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundExc
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
+import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
 import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
 import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
 import org.junit.After;
 import org.junit.Before;
@@ -51,14 +52,15 @@ import org.junit.rules.Timeout;
  */
 public abstract class AbstractProviderTest {
 
-    /** Time-out tests after 20 seconds */
-    @Rule public TestRule globalTimeout= new Timeout(20, TimeUnit.SECONDS);
+    /** Time-out tests after 1 minute. */
+    @Rule
+    public TestRule globalTimeout = new Timeout(1, TimeUnit.MINUTES);
 
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
 
-    private static final CtfTmfTestTrace otherUstTrace = CtfTmfTestTrace.HELLO_LOST;
+    private static final @NonNull CtfTestTrace otherUstTrace = CtfTestTrace.HELLO_LOST;
 
     private CtfTmfTrace fTrace = null;
     private ITmfStateSystem fSS = null;
@@ -72,7 +74,7 @@ public abstract class AbstractProviderTest {
     /**
      * @return The test trace to use for this test
      */
-    protected abstract CtfTmfTestTrace getTestTrace();
+    protected abstract @NonNull CtfTestTrace getTestTrace();
 
     /**
      * @return The name of the executable process in that particular trace
@@ -97,9 +99,9 @@ public abstract class AbstractProviderTest {
      */
     @Before
     public void setUp() {
-        CtfTmfTestTrace testTrace = getTestTrace();
+        CtfTestTrace testTrace = getTestTrace();
 
-        CtfTmfTrace trace = testTrace.getTrace();
+        CtfTmfTrace trace = CtfTmfTestTraceUtils.getTrace(testTrace);
         fTrace = trace;
         fModule = new TestLttngCallStackModule();
         try {
@@ -139,30 +141,31 @@ public abstract class AbstractProviderTest {
     public void testOtherUstTrace() {
         /* Initialize the trace and analysis module */
         File suppDir;
-        try (CtfTmfTrace ustTrace = otherUstTrace.getTrace();) {
-            TestLttngCallStackModule module = null;
+        CtfTmfTrace ustTrace = CtfTmfTestTraceUtils.getTrace(otherUstTrace);
+        TestLttngCallStackModule module = null;
+        try {
+            module = new TestLttngCallStackModule();
             try {
-                module = new TestLttngCallStackModule();
-                try {
-                    assertTrue(module.setTrace(ustTrace));
-                } catch (TmfAnalysisException e) {
-                    fail();
-                }
-                module.schedule();
-                assertTrue(module.waitForCompletion());
-
-                /* Make sure the generated state system exists, but is empty */
-                ITmfStateSystem ss = module.getStateSystem();
-                assertNotNull(ss);
-                assertTrue(ss.getStartTime() >= ustTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue());
-                assertEquals(0, ss.getNbAttributes());
-            } finally {
-                if (module != null) {
-                    module.dispose();
-                }
+                assertTrue(module.setTrace(ustTrace));
+            } catch (TmfAnalysisException e) {
+                fail();
+            }
+            module.schedule();
+            assertTrue(module.waitForCompletion());
+
+            /* Make sure the generated state system exists, but is empty */
+            ITmfStateSystem ss = module.getStateSystem();
+            assertNotNull(ss);
+            assertTrue(ss.getStartTime() >= ustTrace.getStartTime().toNanos());
+            assertEquals(0, ss.getNbAttributes());
+        } finally {
+            if (module != null) {
+                module.dispose();
             }
-            suppDir = new File(TmfTraceManager.getSupplementaryFileDir(ustTrace));
         }
+        suppDir = new File(TmfTraceManager.getSupplementaryFileDir(ustTrace));
+
+        ustTrace.dispose();
         deleteDirectory(suppDir);
         assertFalse(suppDir.exists());
     }
This page took 0.026559 seconds and 5 git commands to generate.