mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 472765: Restore test comments post refactoring
During the testsuite refactoring that significantly improved the DSF
suite (Commit 528de33113
) some info
was lost from the code. This resurrects those comments.
Change-Id: I0a11dee2dcabb0800306880fc7c6217374bc337a
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
This commit is contained in:
parent
64da973dcf
commit
6f249f12c1
1 changed files with 76 additions and 39 deletions
|
@ -86,12 +86,12 @@ import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that interaction with source lookups works as expected.
|
* Tests that interaction with source lookups works as expected.
|
||||||
*
|
* <p>
|
||||||
* All of these tests use one of SourceLookup*.exe that was built from a file
|
* All of these tests use one of SourceLookup*.exe that was built from a file
|
||||||
* that was "moved" since build time. At build time the SourceLookup.cc file was
|
* that was "moved" since build time. At build time the SourceLookup.cc file was
|
||||||
* located in the {@link #BUILD_PATH} directory, but it is now located in the
|
* located in the {@link #BUILD_PATH} directory, but it is now located in the
|
||||||
* {@link BaseTestCase#SOURCE_PATH} directory.
|
* {@link BaseTestCase#SOURCE_PATH} directory.
|
||||||
*
|
* <p>
|
||||||
* The wild card in SourceLookup*.exe can be one of the following to cover the
|
* The wild card in SourceLookup*.exe can be one of the following to cover the
|
||||||
* different effective types of source lookups that need to be done depending on
|
* different effective types of source lookups that need to be done depending on
|
||||||
* how the program was compiled. Each of these options produces different debug
|
* how the program was compiled. Each of these options produces different debug
|
||||||
|
@ -110,13 +110,13 @@ import org.junit.runners.Parameterized;
|
||||||
* </ul>
|
* </ul>
|
||||||
* In addition, there can also be a <b>Dwarf2</b> in the name. That means it is
|
* In addition, there can also be a <b>Dwarf2</b> in the name. That means it is
|
||||||
* designed to run with GDB <= 7.4, see comment in Makefile for OLDDWARFFLAGS.
|
* designed to run with GDB <= 7.4, see comment in Makefile for OLDDWARFFLAGS.
|
||||||
*
|
* <p>
|
||||||
* The result of the variations on compilation arguments means that some of the
|
* The result of the variations on compilation arguments means that some of the
|
||||||
* tests are parameterised.
|
* tests are parameterised.
|
||||||
*
|
* <p>
|
||||||
* Some of the CDT source lookup features require newer versions of GDB than
|
* Some of the CDT source lookup features require newer versions of GDB than
|
||||||
* others, therefore the relevant tests are ignored as needed in the subclasses
|
* others, therefore the relevant tests use assumeGdbVersion* methods to be
|
||||||
* of {@link SourceLookupTest}.
|
* skipped when appropriate.
|
||||||
*/
|
*/
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class SourceLookupTest extends BaseParametrizedTestCase {
|
public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
|
@ -459,13 +459,44 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
assertTrue("Breakpoint failed to install", bp.isInstalled());
|
assertTrue("Breakpoint failed to install", bp.isInstalled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that GDB >= 7.6 because DSF is using the full path name to pass to
|
||||||
|
* the {@link ISourceContainer#findSourceElements(String)}. In versions
|
||||||
|
* prior to 7.6 the fullname field was not returned from GDB if the file was
|
||||||
|
* not found by GDB. See
|
||||||
|
* <a href= "https://sourceware.org/ml/gdb-patches/2012-12/msg00557.html">
|
||||||
|
* the mailing list</a> and associated <a href=
|
||||||
|
* "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=ec83d2110de6831ac2ed0e5a56dc33c60a477eb6">
|
||||||
|
* gdb/NEWS item</a> (although you have to dig quite deep on these changes.)
|
||||||
|
*
|
||||||
|
* Therefore in version < 7.6 the MI frame info has file="SourceLookup.cc"
|
||||||
|
* and no fullname field. This means there is no path to source map against.
|
||||||
|
*
|
||||||
|
* In version >= 7.6 the MI frame info has file="SourceLookup.cc",fullname=
|
||||||
|
* "<cdt.git path>/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/build/SourceLookup.cc"
|
||||||
|
* fields, so there is a path to do the mapping against. Recall that the
|
||||||
|
* test maps
|
||||||
|
* "<cdt.git path>/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/build"
|
||||||
|
* to "<cdt.git path>/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src"
|
||||||
|
*/
|
||||||
|
protected void assumeGdbVersionFullnameWorking() {
|
||||||
|
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inverse of {@link #assumeGdbVersionFullnameWorking()}
|
||||||
|
*/
|
||||||
|
protected void assumeGdbVersionFullnameNotWorking() {
|
||||||
|
assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_6);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test source mappings with executable built with an Absolute and Canonical
|
* Test source mappings with executable built with an Absolute and Canonical
|
||||||
* build path
|
* build path
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sourceMappingAC() throws Throwable {
|
public void sourceMappingAC() throws Throwable {
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionFullnameWorking();
|
||||||
sourceMapping(EXEC_AC_NAME, false);
|
sourceMapping(EXEC_AC_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +515,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sourceMappingAN() throws Throwable {
|
public void sourceMappingAN() throws Throwable {
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionFullnameWorking();
|
||||||
sourceMapping(EXEC_AN_NAME, false);
|
sourceMapping(EXEC_AN_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,9 +526,9 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void sourceSubstituteAN() throws Throwable {
|
public void sourceSubstituteAN() throws Throwable {
|
||||||
/*
|
/*
|
||||||
* GDB < 6.8 does not work correctly with substitute-paths with .. in the
|
* GDB < 6.8 does not work correctly with substitute-paths with .. in
|
||||||
* build path when the build path is an absolute path. GDB 6.8 and above
|
* the build path when the build path is an absolute path. GDB 6.8 and
|
||||||
* works fine in this case.
|
* above works fine in this case.
|
||||||
*/
|
*/
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
|
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
|
||||||
sourceMapping(EXEC_AN_NAME, true);
|
sourceMapping(EXEC_AN_NAME, true);
|
||||||
|
@ -509,7 +540,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sourceMappingRC() throws Throwable {
|
public void sourceMappingRC() throws Throwable {
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionFullnameWorking();
|
||||||
sourceMapping(EXEC_RC_NAME, false);
|
sourceMapping(EXEC_RC_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +559,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sourceMappingRN() throws Throwable {
|
public void sourceMappingRN() throws Throwable {
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionFullnameWorking();
|
||||||
sourceMapping(EXEC_RN_NAME, false);
|
sourceMapping(EXEC_RN_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,9 +570,9 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void sourceSubstituteRN() throws Throwable {
|
public void sourceSubstituteRN() throws Throwable {
|
||||||
/*
|
/*
|
||||||
* GDB < 7.6 does not work correctly with substitute-paths with .. in the
|
* GDB < 7.6 does not work correctly with substitute-paths with .. in
|
||||||
* build path when the build path is a relative path. GDB 7.6 and above
|
* the build path when the build path is a relative path. GDB 7.6 and
|
||||||
* works fine in this case.
|
* above works fine in this case.
|
||||||
*/
|
*/
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
||||||
sourceMapping(EXEC_RN_NAME, true);
|
sourceMapping(EXEC_RN_NAME, true);
|
||||||
|
@ -553,7 +584,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sourceMappingBreakpointsAC() throws Throwable {
|
public void sourceMappingBreakpointsAC() throws Throwable {
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionFullnameWorking();
|
||||||
sourceMappingBreakpoints(EXEC_AC_NAME, false);
|
sourceMappingBreakpoints(EXEC_AC_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,9 +614,9 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void sourceSubstituteBreakpointsAN() throws Throwable {
|
public void sourceSubstituteBreakpointsAN() throws Throwable {
|
||||||
/*
|
/*
|
||||||
* GDB < 6.8 does not work correctly with substitute-paths with .. in the
|
* GDB < 6.8 does not work correctly with substitute-paths with .. in
|
||||||
* build path when the build path is an absolute path. GDB 6.8 and above
|
* the build path when the build path is an absolute path. GDB 6.8 and
|
||||||
* works fine in this case.
|
* above works fine in this case.
|
||||||
*/
|
*/
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
|
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8);
|
||||||
sourceMappingBreakpoints(EXEC_AN_NAME, true);
|
sourceMappingBreakpoints(EXEC_AN_NAME, true);
|
||||||
|
@ -597,7 +628,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sourceMappingBreakpointsRC() throws Throwable {
|
public void sourceMappingBreakpointsRC() throws Throwable {
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionFullnameWorking();
|
||||||
sourceMappingBreakpoints(EXEC_RC_NAME, false);
|
sourceMappingBreakpoints(EXEC_RC_NAME, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,9 +658,9 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void sourceSubstituteBreakpointsRN() throws Throwable {
|
public void sourceSubstituteBreakpointsRN() throws Throwable {
|
||||||
/*
|
/*
|
||||||
* GDB < 7.6 does not work correctly with substitute-paths with .. in the
|
* GDB < 7.6 does not work correctly with substitute-paths with .. in
|
||||||
* build path when the build path is a relative path. GDB 7.6 and above
|
* the build path when the build path is a relative path. GDB 7.6 and
|
||||||
* works fine in this case.
|
* above works fine in this case.
|
||||||
*/
|
*/
|
||||||
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_6);
|
||||||
sourceMappingBreakpoints(EXEC_RN_NAME, true);
|
sourceMappingBreakpoints(EXEC_RN_NAME, true);
|
||||||
|
@ -765,7 +796,11 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void directorySource() throws Throwable {
|
public void directorySource() throws Throwable {
|
||||||
assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_6);
|
/*
|
||||||
|
* DirectorySourceContainer only works if there is no fullname coming
|
||||||
|
* from GDB
|
||||||
|
*/
|
||||||
|
assumeGdbVersionFullnameNotWorking();
|
||||||
DirectorySourceContainer container = new DirectorySourceContainer(new Path(SOURCE_ABSPATH), false);
|
DirectorySourceContainer container = new DirectorySourceContainer(new Path(SOURCE_ABSPATH), false);
|
||||||
setSourceContainer(container);
|
setSourceContainer(container);
|
||||||
doLaunch(EXEC_PATH + EXEC_RC_NAME);
|
doLaunch(EXEC_PATH + EXEC_RC_NAME);
|
||||||
|
@ -1029,26 +1064,28 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
||||||
substituteContainer.addMapEntry(fMapEntrySourceContainerC);
|
substituteContainer.addMapEntry(fMapEntrySourceContainerC);
|
||||||
AbstractSourceLookupDirector director = setSourceContainer(substituteContainer);
|
AbstractSourceLookupDirector director = setSourceContainer(substituteContainer);
|
||||||
|
|
||||||
// Because of the above valid mapping substitution, GDB will provide the proper path
|
/*
|
||||||
// to the source and it will be found no matter what the below mapping is set to.
|
* Because of the above valid mapping substitution, GDB will provide the
|
||||||
// On the other hand, when setting a breakpoint, we have to make sure that the below
|
* proper path to the source and it will be found no matter what the
|
||||||
// mapping does not change the path to something GDB does not know.
|
* below mapping is set to. On the other hand, when setting a
|
||||||
// Therefore, we set the below mapping from an invalid compilation path to the proper source path.
|
* breakpoint, we have to make sure that the below mapping does not
|
||||||
// This is so that if the below mapping is triggered it will cause us to try to set a breakpoint
|
* change the path to something GDB does not know. Therefore, we set the
|
||||||
// in GDB on an invalid path, thus failing the test.
|
* below mapping from an invalid compilation path to the proper source
|
||||||
// This allows to verify that the first mapping is used once it is found to be valid
|
* path. This is so that if the below mapping is triggered it will cause
|
||||||
// and does not fallback to the next mapping.
|
* us to try to set a breakpoint in GDB on an invalid path, thus failing
|
||||||
|
* the test. This allows to verify that the first mapping is used once
|
||||||
|
* it is found to be valid and does not fallback to the next mapping.
|
||||||
|
*/
|
||||||
MappingSourceContainer mapContainer = new MappingSourceContainer("Mappings");
|
MappingSourceContainer mapContainer = new MappingSourceContainer("Mappings");
|
||||||
mapContainer.setIsMappingWithBackendEnabled(false);
|
mapContainer.setIsMappingWithBackendEnabled(false);
|
||||||
mapContainer
|
mapContainer.addMapEntry(new MapEntrySourceContainer("/from_invalid", new Path(SOURCE_ABSPATH)));
|
||||||
.addMapEntry(new MapEntrySourceContainer("/from_invalid", new Path(SOURCE_ABSPATH)));
|
|
||||||
addSourceContainer(director, mapContainer);
|
addSourceContainer(director, mapContainer);
|
||||||
|
|
||||||
doLaunch(EXEC_PATH + EXEC_AC_NAME);
|
doLaunch(EXEC_PATH + EXEC_AC_NAME);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* because the backend substitution applies, we should be able to find the
|
* because the backend substitution applies, we should be able to find
|
||||||
* source with the director or without it.
|
* the source with the director or without it.
|
||||||
*/
|
*/
|
||||||
assertSourceFound();
|
assertSourceFound();
|
||||||
assertInsertBreakpointSuccessful();
|
assertInsertBreakpointSuccessful();
|
||||||
|
|
Loading…
Add table
Reference in a new issue