1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Fixup for "[dsf-gdb] debug tests: Use line tags where possible"

Unfortunately previous commit was submitted too early. There were
two problems that this commit corrects:

1) clear line tags before each test run - side effect of Bug 508642

When a test marked with Intermittent fails, the next retry is executed
with the same class instance.  Therefore, the new try starts with a
non-empty fTagLocations.  The test trips on the check that there are no
duplicate tags.

2) Fix failing testStopAtMainWithReverse

A blank line got inserted into the test case, that
interfered with the test logic.

Change-Id: If4c28557eac7ee740b4e3a5eac5dd2726c39a35d
Also-by: Jonah Graham <jonah@kichwacoders.com>
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
Simon Marchi 2016-12-04 12:05:28 +00:00 committed by Jonah Graham
parent 3a4f8c1ac7
commit 955afec343
3 changed files with 17 additions and 3 deletions

View file

@ -25,9 +25,8 @@ int envTest() {
int main (int argc, char *argv[])
{
envTest(); // FIRST_LINE_IN_MAIN
reverseTest();
stopAtOther();
reverseTest(); // tests assume that every line between first and last
stopAtOther(); // is steppable, so no blank lines allowed.
return 36; // LAST_LINE_IN_MAIN
// Return special value to allow
// testing exit code feature

View file

@ -337,6 +337,20 @@ public class BaseTestCase {
setGdbVersion();
}
/**
* Clear our knowledge of line tags. Must be called before
* resolveLineTagLocations in {@link Intermittent} tests.
* <p>
* This is a workaround for Bug 508642. This may not seem necessary, since
* the fTagLocations field is not static and a new instance of the test
* class is created for each test. However, when a test marked as
* {@link Intermittent} fails, the class instance is re-used, so the content
* of the failed try leaks in the new try.
*/
public void clearLineTags() {
fTagLocations.clear();
}
/**
* Given a set of tags (strings) to find in sourceFile, populate the
* fTagLocations map with the line numbers where they are found.

View file

@ -104,6 +104,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
// parameters. The individual tests will be responsible for starting the launch.
// Looks up line tags in source file(s).
clearLineTags();
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
FIRST_LINE_IN_MAIN = getLineForTag("FIRST_LINE_IN_MAIN");