mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
update test to Eclipse 3.0
This commit is contained in:
parent
1662c1895f
commit
6b222b30ad
5 changed files with 637 additions and 631 deletions
|
@ -1,11 +1,9 @@
|
|||
package org.eclipse.cdt.debug.core.tests;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
@ -43,6 +41,7 @@ import org.eclipse.core.runtime.Path;
|
|||
*
|
||||
*/
|
||||
public class BreakpointTests extends TestCase {
|
||||
|
||||
IWorkspace workspace;
|
||||
IWorkspaceRoot root;
|
||||
static ICProject testProject = null;
|
||||
|
@ -50,17 +49,17 @@ public class BreakpointTests extends TestCase {
|
|||
static ICDISession session = null;
|
||||
static ICDITarget targets[] = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for BreakpointTests
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public BreakpointTests(String name) {
|
||||
super(name);
|
||||
/***
|
||||
* The tests assume that they have a working workspace
|
||||
* and workspace root object to use to create projects/files in,
|
||||
* so we need to get them setup first.
|
||||
/***********************************************************************
|
||||
* The tests assume that they have a working workspace and workspace
|
||||
* root object to use to create projects/files in, so we need to get
|
||||
* them setup first.
|
||||
*/
|
||||
workspace = ResourcesPlugin.getWorkspace();
|
||||
root = workspace.getRoot();
|
||||
|
@ -82,18 +81,18 @@ public class BreakpointTests extends TestCase {
|
|||
*/
|
||||
protected static void oneTimeSetUp() throws CoreException, InvocationTargetException, IOException {
|
||||
ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false);
|
||||
/***
|
||||
/***********************************************************************
|
||||
* Create a new project and import the test source.
|
||||
*/
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.debug.ui.tests").find(new Path("/")).getFile();
|
||||
pluginRoot=pluginRoot+"resources/debugTest.zip";
|
||||
testProject=CProjectHelper.createCProjectWithImport("filetest", pluginRoot);
|
||||
Path imputFile = new Path("resources/debugTest.zip");
|
||||
testProject = CProjectHelper.createCProjectWithImport("filetest", imputFile);
|
||||
if (testProject == null)
|
||||
fail("Unable to create project");
|
||||
/* Build the test project.. */
|
||||
|
||||
testProject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the test fixture.
|
||||
*
|
||||
|
@ -104,13 +103,15 @@ public class BreakpointTests extends TestCase {
|
|||
try {
|
||||
targets[0].terminate();
|
||||
targets = null;
|
||||
} catch (CDIException e) {}
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
}
|
||||
if (session != null) {
|
||||
try {
|
||||
session.terminate();
|
||||
session = null;
|
||||
} catch (CDIException e) {}
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,12 +124,14 @@ public class BreakpointTests extends TestCase {
|
|||
if (targets != null) {
|
||||
try {
|
||||
targets[0].terminate();
|
||||
} catch (CDIException e) {}
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
}
|
||||
if (session != null) {
|
||||
try {
|
||||
session.terminate();
|
||||
} catch (CDIException e) {}
|
||||
} catch (CDIException e) {
|
||||
}
|
||||
}
|
||||
CProjectHelper.delete(testProject);
|
||||
|
||||
|
@ -136,17 +139,18 @@ public class BreakpointTests extends TestCase {
|
|||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite(BreakpointTests.class);
|
||||
/***
|
||||
/***********************************************************************
|
||||
* Create a wrapper suite around the test suite we created above to
|
||||
* allow us to only do the general setup once for all the tests. This
|
||||
* is needed because the creation of the source and target projects
|
||||
* takes a long time and we really only need to do it once. We could
|
||||
* do the setup in the constructor, but we need to be able to remove
|
||||
* everything when we are done.
|
||||
* allow us to only do the general setup once for all the tests. This is
|
||||
* needed because the creation of the source and target projects takes a
|
||||
* long time and we really only need to do it once. We could do the
|
||||
* setup in the constructor, but we need to be able to remove everything
|
||||
* when we are done.
|
||||
*/
|
||||
TestSetup wrapper = new TestSetup(suite) {
|
||||
|
||||
protected void setUp() throws FileNotFoundException, IOException, InterruptedException, InvocationTargetException, CoreException {
|
||||
protected void setUp() throws FileNotFoundException, IOException, InterruptedException, InvocationTargetException,
|
||||
CoreException {
|
||||
oneTimeSetUp();
|
||||
}
|
||||
|
||||
|
@ -157,9 +161,7 @@ public class BreakpointTests extends TestCase {
|
|||
return (wrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
/***************************************************************************
|
||||
* A couple tests to make sure setting breakpoints on functions works as
|
||||
* expected.
|
||||
*/
|
||||
|
@ -173,7 +175,7 @@ public class BreakpointTests extends TestCase {
|
|||
breaks = session.getBreakpointManager();
|
||||
assertNotNull(breaks);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -181,7 +183,7 @@ public class BreakpointTests extends TestCase {
|
|||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point on main
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -189,11 +191,10 @@ public class BreakpointTests extends TestCase {
|
|||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Try to create a break point on a function name that does not exist
|
||||
* We expect that this will cause the setLocationBreakpoint to throw
|
||||
* a CDIException
|
||||
/***********************************************************************
|
||||
* Try to create a break point on a function name that does not exist We
|
||||
* expect that this will cause the setLocationBreakpoint to throw a
|
||||
* CDIException
|
||||
**********************************************************************/
|
||||
|
||||
location = breaks.createLocation(null, "badname", 0);
|
||||
|
@ -207,20 +208,22 @@ public class BreakpointTests extends TestCase {
|
|||
|
||||
breaks.deleteAllBreakpoints();
|
||||
|
||||
/**********************************************************************
|
||||
* Create a break point on a generic function and see if it will
|
||||
* get hit and stop program execution.
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function and see if it will get hit
|
||||
* and stop program execution.
|
||||
**********************************************************************/
|
||||
|
||||
location = breaks.createLocation(null, "func1", 0);
|
||||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
targets = session.getTargets();
|
||||
/* We better only have one target connected to this session or something
|
||||
/*
|
||||
* We better only have one target connected to this session or something
|
||||
* is not right...
|
||||
*/
|
||||
assertTrue(targets.length == 1);
|
||||
/* Resume the target, this should cause it to run till it hits the
|
||||
/*
|
||||
* Resume the target, this should cause it to run till it hits the
|
||||
* breakpoint
|
||||
*/
|
||||
targets[0].resume();
|
||||
|
@ -252,10 +255,9 @@ public class BreakpointTests extends TestCase {
|
|||
session = null;
|
||||
targets = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
/***************************************************************************
|
||||
* A couple tests to make sure setting breakpoints on line numbers works as
|
||||
* expected.
|
||||
*/
|
||||
|
@ -268,26 +270,24 @@ public class BreakpointTests extends TestCase {
|
|||
breaks = session.getBreakpointManager();
|
||||
assertNotNull(breaks);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point in a generic function
|
||||
**********************************************************************/
|
||||
location = breaks.createLocation("main.c", null, 7);
|
||||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point in main
|
||||
**********************************************************************/
|
||||
location = breaks.createLocation("main.c", null, 18);
|
||||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Try to create a break point on a line that does not exist
|
||||
* We expect that this will cause the setLocationBreakpoint to throw
|
||||
* a CDIException
|
||||
/***********************************************************************
|
||||
* Try to create a break point on a line that does not exist We expect
|
||||
* that this will cause the setLocationBreakpoint to throw a
|
||||
* CDIException
|
||||
**********************************************************************/
|
||||
|
||||
location = breaks.createLocation("main.c", null, 30);
|
||||
|
@ -300,7 +300,7 @@ public class BreakpointTests extends TestCase {
|
|||
assertTrue(caught);
|
||||
|
||||
caught = false;
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Try to create a break point on a line that does not have code on it
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -308,7 +308,7 @@ public class BreakpointTests extends TestCase {
|
|||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point in a generic function without passing the source
|
||||
* file name. At the time of writing this would just silently fail, so
|
||||
* to make sure it works, we will do it once with a valid line number
|
||||
|
@ -330,20 +330,22 @@ public class BreakpointTests extends TestCase {
|
|||
|
||||
breaks.deleteAllBreakpoints();
|
||||
|
||||
/**********************************************************************
|
||||
* Create a break point on a line number and see if it will
|
||||
* get hit and stop program execution.
|
||||
/***********************************************************************
|
||||
* Create a break point on a line number and see if it will get hit and
|
||||
* stop program execution.
|
||||
**********************************************************************/
|
||||
|
||||
location = breaks.createLocation(null, null, 7);
|
||||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, null, null);
|
||||
targets = session.getTargets();
|
||||
/* We better only have one target connected to this session or something
|
||||
/*
|
||||
* We better only have one target connected to this session or something
|
||||
* is not right...
|
||||
*/
|
||||
assertTrue(targets.length == 1);
|
||||
/* Resume the target, this should cause it to run till it hits the
|
||||
/*
|
||||
* Resume the target, this should cause it to run till it hits the
|
||||
* breakpoint
|
||||
*/
|
||||
targets[0].resume();
|
||||
|
@ -357,20 +359,21 @@ public class BreakpointTests extends TestCase {
|
|||
break;
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0].isSuspended());
|
||||
assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0]
|
||||
.isSuspended());
|
||||
location = targets[0].getCurrentThread().getStackFrames()[0].getLocation();
|
||||
assertTrue(location.getLineNumber() == 7);
|
||||
assertTrue(location.getFunction().equals("func1"));
|
||||
assertTrue(location.getFile().equals("main.c"));
|
||||
|
||||
|
||||
/* clean up the session */
|
||||
session.terminate();
|
||||
session = null;
|
||||
targets = null;
|
||||
|
||||
}
|
||||
/***
|
||||
|
||||
/***************************************************************************
|
||||
* A couple tests to make sure getting breakpoints works as expected
|
||||
*/
|
||||
public void testGetBreak() throws CoreException, MIException, IOException, CDIException {
|
||||
|
@ -383,17 +386,17 @@ public class BreakpointTests extends TestCase {
|
|||
breaks = session.getBreakpointManager();
|
||||
assertNotNull(breaks);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Make sure initially we don't have any breakpoints
|
||||
**********************************************************************/
|
||||
breakpoints = breaks.getBreakpoints();
|
||||
assertNotNull(breakpoints);
|
||||
assertTrue(breakpoints.length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Make sure if we create a simple breakpoint, that we can get it back
|
||||
* from the system
|
||||
*********************************************************************/
|
||||
**********************************************************************/
|
||||
/* Create a break point on a generic function */
|
||||
location = breaks.createLocation("main.c", "func1", 0);
|
||||
assertNotNull(location);
|
||||
|
@ -410,9 +413,9 @@ public class BreakpointTests extends TestCase {
|
|||
|
||||
assertTrue(curbreak.getLocation().equals(location));
|
||||
|
||||
/**********************************************************************
|
||||
* Make sure if we create multiple break points that we can still
|
||||
* get them all back from the system,
|
||||
/***********************************************************************
|
||||
* Make sure if we create multiple break points that we can still get
|
||||
* them all back from the system,
|
||||
**********************************************************************/
|
||||
/* Create another break point on main */
|
||||
location = breaks.createLocation("main.c", "main", 0);
|
||||
|
@ -427,20 +430,20 @@ public class BreakpointTests extends TestCase {
|
|||
} else
|
||||
curbreak = null;
|
||||
assertNotNull(curbreak);
|
||||
/* Make sure the location still looks like we expect it to..
|
||||
. */
|
||||
/*
|
||||
* Make sure the location still looks like we expect it to.. .
|
||||
*/
|
||||
assertTrue(curbreak.getLocation().equals(location));
|
||||
|
||||
breaks.deleteAllBreakpoints();
|
||||
|
||||
|
||||
/* clean up the session */
|
||||
session.terminate();
|
||||
session = null;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
/***************************************************************************
|
||||
* A couple tests to make sure deleting breakpoints works as expected
|
||||
*/
|
||||
public void testDelBreak() throws CoreException, MIException, IOException, CDIException {
|
||||
|
@ -459,10 +462,10 @@ public class BreakpointTests extends TestCase {
|
|||
assertNotNull(breakpoints);
|
||||
assertTrue(breakpoints.length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
*
|
||||
* Test to make sure if we create a new breakpoint, we can delete
|
||||
* it by passing a refrence to it to deleteBreakpoint()
|
||||
* Test to make sure if we create a new breakpoint, we can delete it by
|
||||
* passing a refrence to it to deleteBreakpoint()
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -478,7 +481,7 @@ public class BreakpointTests extends TestCase {
|
|||
breakpoints = breaks.getBreakpoints();
|
||||
assertTrue(breakpoints.length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
*
|
||||
* Test to make sure if we create multiple new breakpoint, we can delete
|
||||
* one of them by passing a refrence to it to deleteBreakpoint()
|
||||
|
@ -497,14 +500,14 @@ public class BreakpointTests extends TestCase {
|
|||
breaks.deleteBreakpoint(curbreak);
|
||||
pause();
|
||||
breakpoints = breaks.getBreakpoints();
|
||||
/***
|
||||
/***********************************************************************
|
||||
* Make sure there is only 1 breakpoint left, and it's the one we expect
|
||||
*/
|
||||
assertTrue(breakpoints.length == 1);
|
||||
curbreak = (ICDILocationBreakpoint) breakpoints[0];
|
||||
assertNotNull(curbreak);
|
||||
assertTrue(curbreak.getLocation().equals(savedLocation));
|
||||
/***
|
||||
/***********************************************************************
|
||||
* Then delete the other breakpoint.
|
||||
*/
|
||||
breaks.deleteBreakpoint(curbreak);
|
||||
|
@ -512,7 +515,7 @@ public class BreakpointTests extends TestCase {
|
|||
breakpoints = breaks.getBreakpoints();
|
||||
assertTrue(breakpoints.length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Make sure deleteBreakpoints works when given 1 breakpoint to delete
|
||||
**********************************************************************/
|
||||
savedbreakpoints = new ICDIBreakpoint[1];
|
||||
|
@ -535,7 +538,7 @@ public class BreakpointTests extends TestCase {
|
|||
pause();
|
||||
assertTrue(breaks.getBreakpoints().length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Make sure deleteBreakpoints works when given more then 1 but less
|
||||
* then all breakpoints to delete
|
||||
**********************************************************************/
|
||||
|
@ -560,7 +563,7 @@ public class BreakpointTests extends TestCase {
|
|||
pause();
|
||||
assertTrue(breaks.getBreakpoints().length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Make sure deleteBreakpoints works when given all the breakpoints
|
||||
**********************************************************************/
|
||||
savedbreakpoints = new ICDIBreakpoint[10];
|
||||
|
@ -575,7 +578,7 @@ public class BreakpointTests extends TestCase {
|
|||
breakpoints = breaks.getBreakpoints();
|
||||
assertTrue(breakpoints.length == 0);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Make sure deleteAllBreakpoints works
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -590,14 +593,13 @@ public class BreakpointTests extends TestCase {
|
|||
breakpoints = breaks.getBreakpoints();
|
||||
assertTrue(breakpoints.length == 0);
|
||||
|
||||
|
||||
|
||||
/* clean up the session */
|
||||
session.terminate();
|
||||
session = null;
|
||||
|
||||
}
|
||||
/***
|
||||
|
||||
/***************************************************************************
|
||||
* A couple tests to make sure setting breakpoints with conditions seems to
|
||||
* work as expected.
|
||||
*/
|
||||
|
@ -611,7 +613,7 @@ public class BreakpointTests extends TestCase {
|
|||
breaks = session.getBreakpointManager();
|
||||
assertNotNull(breaks);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function with an empty condition
|
||||
**********************************************************************/
|
||||
cond = breaks.createCondition(0, "");
|
||||
|
@ -619,7 +621,7 @@ public class BreakpointTests extends TestCase {
|
|||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function with an valid condition
|
||||
**********************************************************************/
|
||||
cond = breaks.createCondition(0, "x<10");
|
||||
|
@ -627,7 +629,7 @@ public class BreakpointTests extends TestCase {
|
|||
assertNotNull(location);
|
||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function with an invalid condition
|
||||
* We expect to get a CDIException when we try to set the breakpoint.
|
||||
**********************************************************************/
|
||||
|
@ -641,7 +643,7 @@ public class BreakpointTests extends TestCase {
|
|||
}
|
||||
assertTrue(caught);
|
||||
|
||||
/**********************************************************************
|
||||
/***********************************************************************
|
||||
* Create a break point on a line number with a condition and make sure
|
||||
* it does not suspend execution of the application until the condition
|
||||
* is true
|
||||
|
@ -653,11 +655,13 @@ public class BreakpointTests extends TestCase {
|
|||
|
||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
||||
targets = session.getTargets();
|
||||
/* We better only have one target connected to this session or something
|
||||
/*
|
||||
* We better only have one target connected to this session or something
|
||||
* is not right...
|
||||
*/
|
||||
assertTrue(targets.length == 1);
|
||||
/* Resume the target, this should cause it to run till it hits the
|
||||
/*
|
||||
* Resume the target, this should cause it to run till it hits the
|
||||
* breakpoint
|
||||
*/
|
||||
targets[0].resume();
|
||||
|
@ -671,15 +675,14 @@ public class BreakpointTests extends TestCase {
|
|||
break;
|
||||
Thread.sleep(100);
|
||||
}
|
||||
assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0].isSuspended());
|
||||
assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0]
|
||||
.isSuspended());
|
||||
location = targets[0].getCurrentThread().getStackFrames()[0].getLocation();
|
||||
assertTrue(location.getLineNumber() == 23);
|
||||
assertTrue(location.getFunction().equals("main"));
|
||||
assertTrue(location.getFile().equals("main.c"));
|
||||
/* Get the value of a and and make sure it is 11 */
|
||||
assertTrue(targets[0].evaluateExpressionToString("a"),
|
||||
targets[0].evaluateExpressionToString("a").equals("11"));
|
||||
|
||||
assertTrue(targets[0].evaluateExpressionToString("a"), targets[0].evaluateExpressionToString("a").equals("11"));
|
||||
|
||||
/* clean up the session */
|
||||
session.terminate();
|
||||
|
@ -687,6 +690,7 @@ public class BreakpointTests extends TestCase {
|
|||
targets = null;
|
||||
|
||||
}
|
||||
|
||||
void pause() {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
|
|||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
|
@ -78,9 +79,8 @@ public class DebugTests extends TestCase {
|
|||
/***
|
||||
* Create a new project and import the test source.
|
||||
*/
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.debug.ui.tests").find(new Path("/")).getFile();
|
||||
pluginRoot=pluginRoot+"resources/debugTest.zip";
|
||||
testProject=CProjectHelper.createCProjectWithImport("filetest", pluginRoot);
|
||||
IPath importFile = new Path("resources/debugTest.zip");
|
||||
testProject=CProjectHelper.createCProjectWithImport("filetest", importFile);
|
||||
if (testProject==null)
|
||||
fail("Unable to create project");
|
||||
/* Build the test project.. */
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
|
|||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
|
@ -79,9 +80,8 @@ public class LocationTests extends TestCase {
|
|||
/***
|
||||
* Create a new project and import the test source.
|
||||
*/
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.debug.ui.tests").find(new Path("/")).getFile();
|
||||
pluginRoot=pluginRoot+"resources/debugTest.zip";
|
||||
testProject=CProjectHelper.createCProjectWithImport("filetest", pluginRoot);
|
||||
IPath importFile = new Path("resources/debugTest.zip");
|
||||
testProject=CProjectHelper.createCProjectWithImport("filetest", importFile);
|
||||
if (testProject==null)
|
||||
fail("Unable to create project");
|
||||
/* Build the test project.. */
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,6 @@
|
|||
package org.eclipse.cdt.debug.testplugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.zip.ZipFile;
|
||||
|
@ -35,7 +36,7 @@ public class CProjectHelper {
|
|||
/**
|
||||
* Creates a ICProject.
|
||||
*/
|
||||
public static ICProject createCProjectWithImport(String projectName, String zipFile) throws CoreException, InvocationTargetException, IOException {
|
||||
public static ICProject createCProjectWithImport(String projectName, IPath zipFile) throws CoreException, InvocationTargetException, IOException {
|
||||
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
|
||||
IProject project= root.getProject(projectName);
|
||||
if (!project.exists()) {
|
||||
|
@ -47,7 +48,8 @@ public class CProjectHelper {
|
|||
if (!project.isOpen()) {
|
||||
project.open(null);
|
||||
}
|
||||
importFilesFromZip(new ZipFile(zipFile),project.getFullPath(),null);
|
||||
File zip = CTestPlugin.getDefault().getFileInPlugin(zipFile);
|
||||
importFilesFromZip(new ZipFile(zip),project.getFullPath(),null);
|
||||
|
||||
if (!project.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||
addNatureToProject(project, CProjectNature.C_NATURE_ID, null);
|
||||
|
|
Loading…
Add table
Reference in a new issue