| author | Alexandre Montplaisir | 2012-03-17 20:36:45 (EDT) |
|---|---|---|
| committer | Francois Chouinard | 2012-03-19 17:44:01 (EDT) |
| commit | 512f28fdb0bdaaab2de9a034784c73a973e2af0e (patch) (side-by-side diff) | |
| tree | 9478867da24168fa1052b71c63d1a281d73a4d20 | |
| parent | b714e56f44c8b93dd4c944c0c245b27fa880e1e8 (diff) | |
| download | org.eclipse.linuxtools-512f28fdb0bdaaab2de9a034784c73a973e2af0e.zip org.eclipse.linuxtools-512f28fdb0bdaaab2de9a034784c73a973e2af0e.tar.gz org.eclipse.linuxtools-512f28fdb0bdaaab2de9a034784c73a973e2af0e.tar.bz2 | |
Start fixing GSS tests
5 files changed, 29 insertions, 29 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/.gitignore b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/.gitignore index 8d94ef8..edb55c4 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/.gitignore +++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/.gitignore @@ -3,3 +3,5 @@ bin javaCompiler...args build.xml target + +traces/ diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFDummyInputTest.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFDummyInputTest.java index 0576a55..9943be4 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFDummyInputTest.java +++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFDummyInputTest.java @@ -12,6 +12,8 @@ package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider; +import java.io.FileNotFoundException; + import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CTFDummyInput; import org.junit.BeforeClass; @@ -25,7 +27,7 @@ public class CTFDummyInputTest extends CTFKernelStateInputTest { /* Hiding superclass method */ @BeforeClass - public static void initialize() { + public static void initialize() throws FileNotFoundException { input = new CTFDummyInput(CTFTestFiles.getTestTrace()); } diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFKernelStateInputTest.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFKernelStateInputTest.java index 411052b..57f0b71 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFKernelStateInputTest.java +++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFKernelStateInputTest.java @@ -14,6 +14,8 @@ package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider; import static org.junit.Assert.*; +import java.io.FileNotFoundException; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -32,7 +34,7 @@ public class CTFKernelStateInputTest { protected static IStateChangeInput input; @BeforeClass - public static void initialize() { + public static void initialize() throws FileNotFoundException { input = new CTFKernelStateInput(CTFTestFiles.getTestTrace()); } @@ -46,7 +48,7 @@ public class CTFKernelStateInputTest { public void testOpening() { long testStartTime; testStartTime = input.getStartTime(); - assertTrue(testStartTime == CTFTestFiles.startTime1); + assertEquals(testStartTime, CTFTestFiles.startTime); } @Test diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFTestFiles.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFTestFiles.java index 8348dfd..5293474 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFTestFiles.java +++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/CTFTestFiles.java @@ -34,23 +34,17 @@ public abstract class CTFTestFiles { * and extract it at the root of the project. You can also set up a custom * path below. */ - public final static String traceFile1 = "trace1/kernel"; //$NON-NLS-1$ - public final static long startTime1 = 17620320801208L; - - public static CtfTmfTrace trace1 = null; - - public static CtfTmfTrace getTestTrace() { - if (trace1 == null) { - trace1 = new CtfTmfTrace(); - try { - trace1.initTrace("test-trace1", traceFile1, CtfTmfEvent.class); //$NON-NLS-1$ - } catch (FileNotFoundException e) { - /* If we don't have the file, we shouldn't even try the tests... */ - e.printStackTrace(); - return null; - } + public final static String traceFile = "traces/trace2"; //$NON-NLS-1$ + public final static long startTime = 18669367225825L; + + public static CtfTmfTrace trace = null; + + public static CtfTmfTrace getTestTrace() throws FileNotFoundException { + if (trace == null) { + trace = new CtfTmfTrace(); + trace.initTrace("test-trace2", traceFile, CtfTmfEvent.class); //$NON-NLS-1$ } - return trace1; + return trace; } } diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java index 8830f80..4a5e799 100644 --- a/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java +++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java @@ -196,14 +196,14 @@ public class StateSystemFullHistoryTest { */ @Test(expected = TimeRangeException.class) public void testFullQueryInvalidTime1() throws TimeRangeException { - shs.loadStateAtTime(CTFTestFiles.startTime1 + 20L + shs.loadStateAtTime(CTFTestFiles.startTime + 20L * CTFTestFiles.NANOSECS_PER_SEC); } @Test(expected = TimeRangeException.class) public void testFullQueryInvalidTime2() throws TimeRangeException { - shs.loadStateAtTime(CTFTestFiles.startTime1 - 20L + shs.loadStateAtTime(CTFTestFiles.startTime - 20L * CTFTestFiles.NANOSECS_PER_SEC); } @@ -213,7 +213,7 @@ public class StateSystemFullHistoryTest { throws AttributeNotFoundException, TimeRangeException { int quark = shs.getQuarkAbsolute("CPUs", "0", "Current_thread"); - long time = CTFTestFiles.startTime1 + 20L + long time = CTFTestFiles.startTime + 20L * CTFTestFiles.NANOSECS_PER_SEC; shs.querySingleState(time, quark); } @@ -223,7 +223,7 @@ public class StateSystemFullHistoryTest { throws AttributeNotFoundException, TimeRangeException { int quark = shs.getQuarkAbsolute("CPUs", "0", "Current_thread"); - long time = CTFTestFiles.startTime1 - 20L + long time = CTFTestFiles.startTime - 20L * CTFTestFiles.NANOSECS_PER_SEC; shs.querySingleState(time, quark); } @@ -233,9 +233,9 @@ public class StateSystemFullHistoryTest { TimeRangeException { int quark = shs.getQuarkAbsolute("CPUs", "0", "Current_thread"); - long time1 = CTFTestFiles.startTime1 - 20L + long time1 = CTFTestFiles.startTime - 20L * CTFTestFiles.NANOSECS_PER_SEC; /* invalid */ - long time2 = CTFTestFiles.startTime1 + 1L + long time2 = CTFTestFiles.startTime + 1L * CTFTestFiles.NANOSECS_PER_SEC; /* valid */ shs.queryHistoryRange(quark, time1, time2); @@ -246,9 +246,9 @@ public class StateSystemFullHistoryTest { AttributeNotFoundException { int quark = shs.getQuarkAbsolute("CPUs", "0", "Current_thread"); - long time1 = CTFTestFiles.startTime1 + 1L + long time1 = CTFTestFiles.startTime + 1L * CTFTestFiles.NANOSECS_PER_SEC; /* valid */ - long time2 = CTFTestFiles.startTime1 + 20L + long time2 = CTFTestFiles.startTime + 20L * CTFTestFiles.NANOSECS_PER_SEC; /* invalid */ shs.queryHistoryRange(quark, time1, time2); @@ -259,9 +259,9 @@ public class StateSystemFullHistoryTest { AttributeNotFoundException { int quark = shs.getQuarkAbsolute("CPUs", "0", "Current_thread"); - long time1 = CTFTestFiles.startTime1 - 1L + long time1 = CTFTestFiles.startTime - 1L * CTFTestFiles.NANOSECS_PER_SEC; /* invalid */ - long time2 = CTFTestFiles.startTime1 + 20L + long time2 = CTFTestFiles.startTime + 20L * CTFTestFiles.NANOSECS_PER_SEC; /* invalid */ shs.queryHistoryRange(quark, time1, time2); |

