1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 456738 - TraceFile tests cause failures

Change-Id: Ida45dbe1ba4d37f3bc0e668c30c05f616d585c55
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/39013
Tested-by: Hudson CI
Reviewed-by: Mikhail Khodjaiants <mikhailkhod@googlemail.com>
This commit is contained in:
Marc Khouzam 2015-01-05 19:37:57 -05:00
parent d6a510ab06
commit c0ea87636e

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012 Mentor Graphics and others. * Copyright (c) 2012, 2014 Mentor Graphics and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,13 +7,14 @@
* *
* Contributors: * Contributors:
* Mentor Graphics - Initial API and implementation * Mentor Graphics - Initial API and implementation
* Marc Khouzam (Ericsson) - Run tests in alphabetical order since they are dependent on each other.
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4; package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -55,8 +56,12 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass;
import org.junit.FixMethodOrder;
import org.junit.Test; import org.junit.Test;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TraceFileTest_7_4 extends BaseTestCase { public class TraceFileTest_7_4 extends BaseTestCase {
private final static String FILE_NAME = "TracepointTestApp.cc"; private final static String FILE_NAME = "TracepointTestApp.cc";
@ -85,6 +90,18 @@ public class TraceFileTest_7_4 extends BaseTestCase {
// Each test sets its own launch attributes // Each test sets its own launch attributes
} }
@AfterClass
public static void doAfterClassTraceFileTest_7_4() {
try {
// Make sure we don't have any tracepoint actions
// or any kind of breakpoints in the workspace
// so that tests run after this class are not affected
deleteActionsAndBreakpoints();
} catch (Throwable e) {
System.out.println("ERROR: Failed to delete all breakpoints");
}
}
@Override @Override
@After @After
public void doAfterTest() throws Exception { public void doAfterTest() throws Exception {
@ -113,8 +130,11 @@ public class TraceFileTest_7_4 extends BaseTestCase {
* 7. Saves the trace data into a file (data/launch/bin/trace). * 7. Saves the trace data into a file (data/launch/bin/trace).
*/ */
@Test @Test
public void createTraceFile() throws Throwable { public void a_createTraceFile() throws Throwable {
// Make sure that there are no tracepoint actions and no platform breakpoints in the workspace.
deleteActionsAndBreakpoints();
deleteOldTraceFile(); deleteOldTraceFile();
startRemoteSession(); startRemoteSession();
setTracepoints(); setTracepoints();
MIBreakpointDMContext bptDMC = setBreakpointAtEndLine(); MIBreakpointDMContext bptDMC = setBreakpointAtEndLine();
@ -132,10 +152,10 @@ public class TraceFileTest_7_4 extends BaseTestCase {
* actions are created. * actions are created.
*/ */
@Test @Test
public void testTraceFile() throws Throwable { public void b_testTraceFile() throws Throwable {
// Make sure that there is no tracepoint actions and platform breakpoints // Make sure that there are no tracepoint actions and no platform breakpoints in the workspace.
// are in the workspace.
deleteActionsAndBreakpoints(); deleteActionsAndBreakpoints();
startTraceFileSession(); startTraceFileSession();
// Verify that required tracepoints and new tracepoint actions are created. // Verify that required tracepoints and new tracepoint actions are created.
checkActionsAndTracepoints(); checkActionsAndTracepoints();
@ -144,10 +164,10 @@ public class TraceFileTest_7_4 extends BaseTestCase {
/** /**
* This test verifies that the tracepoint actions and platform tracepoints * This test verifies that the tracepoint actions and platform tracepoints
* created by 'testTraceFile()' are associated with the corresponding target * created by 'testTraceFile()' are associated with the corresponding target
* tracepoints. * tracepoints and are not created a second time.
*/ */
@Test @Test
public void testTraceFileWithExistingTracepoints() throws Throwable { public void c_testTraceFileWithExistingTracepoints() throws Throwable {
// Verify that actions and tracepoints required for this test are in place. // Verify that actions and tracepoints required for this test are in place.
checkActionsAndTracepoints(); checkActionsAndTracepoints();
startTraceFileSession(); startTraceFileSession();
@ -184,7 +204,7 @@ public class TraceFileTest_7_4 extends BaseTestCase {
/** /**
* Deletes all tracepoint actions and all existing platform breakpoints. * Deletes all tracepoint actions and all existing platform breakpoints.
*/ */
private void deleteActionsAndBreakpoints() throws Throwable { private static void deleteActionsAndBreakpoints() throws Throwable {
TracepointActionManager tam = TracepointActionManager.getInstance(); TracepointActionManager tam = TracepointActionManager.getInstance();
IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager(); IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();