os.tests: introduce test cases for the kernel analysis module
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core.tests / src / org / eclipse / tracecompass / analysis / os / linux / core / tests / kernelanalysis / KernelStateProviderTest.java
CommitLineData
efc403bb 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2012, 2015 Ericsson
efc403bb
AM
3 * Copyright (c) 2010, 2011 École Polytechnique de Montréal
4 * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
e743c3b8 5 *
efc403bb
AM
6 * All rights reserved. This program and the accompanying materials are
7 * made available under the terms of the Eclipse Public License v1.0 which
8 * accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
e743c3b8 10 *
efc403bb
AM
11 *******************************************************************************/
12
6d16f5a9 13package org.eclipse.tracecompass.analysis.os.linux.core.tests.kernelanalysis;
efc403bb 14
b4f71e4a 15import static org.junit.Assert.assertEquals;
8020be3c 16
c4d57ac1 17import org.eclipse.jdt.annotation.NonNull;
0783ea52
GB
18import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.LinuxTestCase;
19import org.eclipse.tracecompass.analysis.os.linux.core.tests.stubs.kernel.KernelAnalysisTestFactory;
698fde87 20import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
c8f45ad2 21import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.KernelStateProvider;
2bdf0193 22import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
698fde87
GB
23import org.junit.After;
24import org.junit.Before;
efc403bb 25import org.junit.Test;
efc403bb
AM
26
27/**
e363eae1 28 * Tests for the {@link KernelStateProvider}
e743c3b8 29 *
2ba3d0a1 30 * @author Alexandre Montplaisir
efc403bb 31 */
6d16f5a9 32public class KernelStateProviderTest {
efc403bb 33
0783ea52 34 private static final @NonNull LinuxTestCase KERNEL_TEST_CASE = KernelAnalysisTestFactory.KERNEL_SCHED;
92ba8466 35
698fde87
GB
36 private IKernelTrace fTrace;
37 private ITmfStateProvider fInput;
efc403bb 38
2ba3d0a1
AM
39 /**
40 * Set-up.
2ba3d0a1 41 */
698fde87
GB
42 @Before
43 public void initialize() {
0783ea52 44 IKernelTrace thetrace = KERNEL_TEST_CASE.getKernelTrace();
698fde87
GB
45 fTrace = thetrace;
46 fInput = new KernelStateProvider(thetrace, thetrace.getKernelEventLayout());
c4d57ac1
AM
47 }
48
49 /**
50 * Class teardown
51 */
698fde87
GB
52 @After
53 public void classTeardown() {
54 if (fTrace != null) {
55 fTrace.dispose();
c4d57ac1 56 }
efc403bb
AM
57 }
58
2ba3d0a1
AM
59 /**
60 * Test loading the state provider.
61 */
efc403bb
AM
62 @Test
63 public void testOpening() {
64 long testStartTime;
698fde87
GB
65 testStartTime = fInput.getStartTime();
66 /* Expected start time of the trace */
67 assertEquals(testStartTime, 1L);
efc403bb
AM
68 }
69
efc403bb 70}
This page took 0.076177 seconds and 5 git commands to generate.