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

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-01-24 16:30:50 -05:00
commit eebb8a0b5e
61 changed files with 5653 additions and 5152 deletions

View file

@ -29,7 +29,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
/**
* This is style checker for function name code style. Pattern parameter is
* regular expression defining the style.
*
*/
public class NamingConventionFunctionChecker extends AbstractIndexAstChecker implements ICheckerWithPreferences {
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker"; //$NON-NLS-1$
@ -50,7 +49,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
public int visit(IASTDeclaration element) {
if (element instanceof IASTFunctionDefinition) {
IASTName astName = ((IASTFunctionDefinition) element).getDeclarator().getName();
String name = getSearchibleName(astName);
String name = getSearchableName(astName);
if (name != null) {
for (Iterator<IProblem> iterator = pts.iterator(); iterator.hasNext();) {
IProblem pt = iterator.next();
@ -68,18 +67,14 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
return PROCESS_SKIP;
}
public boolean shouldReport(IASTName astName, IProblem pt) {
private boolean shouldReport(IASTName astName, IProblem pt) {
if (astName instanceof ICPPASTQualifiedName) {
return shouldReportCppMethods(pt);
}
return true;
}
/**
* @param astName
* @return
*/
public String getSearchibleName(IASTName astName) {
private String getSearchableName(IASTName astName) {
String name = astName.toString();
if (astName instanceof ICPPASTQualifiedName) {
ICPPASTQualifiedName cppAstName = (ICPPASTQualifiedName) astName;
@ -104,13 +99,6 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.cdt.codan.core.model.ICheckerWithPreferences#initParameters
* (org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
*/
@Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 Intel Corporation and others.
* Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,12 +8,16 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* James Blackburn (Broadcom Corp.)
* Christian Walther (Indel AG) - [335344] test for changing language IDs
* Christian Walther (Indel AG) - bug 335344: test for changing language IDs
* Raphael Zulliger (Indel AG) - bug 284699: test having macros with same
* name but different values in same project
* configuration
*******************************************************************************/
package org.eclipse.cdt.core.settings.model;
import java.util.Arrays;
import java.util.HashMap;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.IPDOMManager;
@ -29,7 +33,7 @@ import org.eclipse.core.runtime.Path;
public class ExternalSettingsProviderTests extends BaseTestCase{
private static final String PROJ_NAME_PREFIX = "espt_";
ICProject p1, p2, p3, p4, p5;
ICProject p1, p2, p3, p4, p5, p6;
public static TestSuite suite() {
return suite(ExternalSettingsProviderTests.class, "_");
@ -42,6 +46,7 @@ public class ExternalSettingsProviderTests extends BaseTestCase{
p3 = CProjectHelper.createNewStileCProject(PROJ_NAME_PREFIX + "c", IPDOMManager.ID_NO_INDEXER);
p4 = CProjectHelper.createNewStileCProject(PROJ_NAME_PREFIX + "d", IPDOMManager.ID_NO_INDEXER);
p5 = CProjectHelper.createNewStileCProject(PROJ_NAME_PREFIX + "e", IPDOMManager.ID_NO_INDEXER);
p6 = CProjectHelper.createNewStileCProject(PROJ_NAME_PREFIX + "f", IPDOMManager.ID_NO_INDEXER);
}
/**
@ -426,6 +431,40 @@ public class ExternalSettingsProviderTests extends BaseTestCase{
assertTrue(Arrays.equals(expectedEntriesSet, entries));
}
/**
* Test if macros with the same name but different values can coexist when
* they belong to different language ids
*/
public void testSameMacroWithDifferentValuesAndDifferentLanguageIds() throws CoreException {
TestExtSettingsProvider.setVariantNum(4);
CoreModel model = CoreModel.getDefault();
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
IProject project = p6.getProject();
// add external settings provider
ICProjectDescription des = model.getProjectDescription(project);
ICConfigurationDescription cfgDes = des.getConfigurations()[0];
String[] extPIds = new String[]{TestExtSettingsProvider.TEST_EXTERNAL_PROVIDER_ID};
cfgDes.setExternalSettingsProviderIds(extPIds);
ICFolderDescription root = cfgDes.getRootFolderDescription();
model.setProjectDescription(project, des);
// read out the settings it caused
des = model.getProjectDescription(project, false);
cfgDes = des.getConfigurations()[0];
root = cfgDes.getRootFolderDescription();
for (ICLanguageSetting s: root.getLanguageSettings()) {
if( s.getLanguageId().equals("org.eclipse.cdt.core.assembly") ) {
assertEquals(1, s.getSettingEntries(ICSettingEntry.MACRO).length);
assertEquals("TheValue", s.getSettingEntries(4)[0].getValue());
} if( s.getLanguageId().equals("org.eclipse.cdt.core.g++") ) {
assertEquals(1, s.getSettingEntries(ICSettingEntry.MACRO).length);
assertEquals("", s.getSettingEntries(ICSettingEntry.MACRO)[0].getValue());
}
}
}
@Override
protected void tearDown() throws Exception {
try {
@ -448,5 +487,9 @@ public class ExternalSettingsProviderTests extends BaseTestCase{
p5.getProject().delete(true, null);
} catch (CoreException e){
}
try {
p6.getProject().delete(true, null);
} catch (CoreException e){
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 Intel Corporation and others.
* Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,7 +7,10 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
* Christian Walther (Indel AG) - [335344] test for changing language IDs
* Christian Walther (Indel AG) - bug 335344: test for changing language IDs
* Raphael Zulliger (Indel AG) - bug 284699: test having macros with same
* name but different values in same project
* configuration
*******************************************************************************/
package org.eclipse.cdt.core.settings.model;
@ -86,11 +89,33 @@ public class TestExtSettingsProvider extends CExternalSettingProvider {
)
};
private static CExternalSetting[] SETTINGS_5 = new CExternalSetting[]{
new CExternalSetting(
new String[]{
"org.eclipse.cdt.core.g++"
},
null, null,
new ICSettingEntry[]{
new CMacroEntry("THE_MACRO", "", 0)
}
),
new CExternalSetting(
new String[]{
"org.eclipse.cdt.core.assembly"
},
null, null,
new ICSettingEntry[]{
new CMacroEntry("THE_MACRO", "TheValue", 0)
}
)
};
public static final CExternalSetting[][] SETTINGS_VARIANTS = new CExternalSetting[][]{
SETTINGS_1,
SETTINGS_2,
SETTINGS_3,
SETTINGS_4};
SETTINGS_4,
SETTINGS_5};
private static int variantNum;

View file

@ -256,7 +256,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
private ICProject cproject;
private StringBuilder[] testData;
private IASTTranslationUnit ast;
private boolean cpp;
private final boolean cpp;
public SinglePDOMTestFirstASTStrategy(boolean cpp) {
this.cpp = cpp;
@ -342,7 +342,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
private ICProject cproject;
private StringBuilder[] testData;
private IASTTranslationUnit ast;
private boolean cpp;
private final boolean cpp;
public SinglePDOMTestStrategy(boolean cpp) {
this.cpp = cpp;
@ -392,7 +392,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
if (DEBUG) {
System.out.println("Project PDOM: "+getName());
System.out.println("Project PDOM: " + getName());
((PDOM)CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
}
@ -501,7 +501,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
assertTrue(CCorePlugin.getIndexManager().joinIndexer(360000, new NullProgressMonitor()));
if (DEBUG) {
System.out.println("Project PDOM: "+getName());
System.out.println("Project PDOM: " + getName());
((PDOM) CCoreInternals.getPDOMManager().getPDOM(cproject)).accept(new PDOMPrettyPrinter());
}
@ -539,7 +539,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
private ICProject cproject, referenced;
private StringBuilder[] testData;
private IASTTranslationUnit ast;
private boolean cpp;
private final boolean cpp;
public ReferencedProject(boolean cpp) {
this.cpp = cpp;

View file

@ -67,8 +67,9 @@ public class IndexNamesTests extends BaseTestCase {
}
public String getComment() throws IOException {
return TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), 1)[0].toString();
CharSequence[] contents = TestSourceReader.getContentsForTest(
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), 1);
return contents[0].toString();
}
protected IFile createFile(IContainer container, String fileName, String contents) throws Exception {

View file

@ -21,9 +21,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
public class CTestPlugin extends Plugin {
public static final String PLUGIN_ID = "org.eclipse.cdt.core.tests";
private static CTestPlugin fgDefault;
@ -55,7 +53,4 @@ public class CTestPlugin extends Plugin {
return null;
}
}
}

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.testplugin.CTestPlugin;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@ -45,8 +46,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.Bundle;
/**
@ -247,17 +250,23 @@ public class TestSourceReader {
* @throws CoreException
* @since 4.0
*/
public static IFile createFile(final IContainer container, final IPath filePath, final String contents) throws CoreException {
public static IFile createFile(final IContainer container, final IPath filePath,
final CharSequence contents) throws CoreException {
final IWorkspace ws = ResourcesPlugin.getWorkspace();
final IFile result[] = new IFile[1];
ws.run(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
//Obtain file handle
// Obtain file handle
IFile file = container.getFile(filePath);
InputStream stream = new ByteArrayInputStream(contents.getBytes());
//Create file input stream
InputStream stream;
try {
stream = new ByteArrayInputStream(contents.toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new CoreException(new Status(IStatus.ERROR, CTestPlugin.PLUGIN_ID, null, e));
}
// Create file input stream
if (file.exists()) {
long timestamp= file.getLocalTimeStamp();
file.setContents(stream, false, false, new NullProgressMonitor());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Intel Corporation and others.
* Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,8 @@
*
* Contributors:
* Intel Corporation - Initial API and implementation
* Raphael Zulliger (Indel AG) - bug 284699: fixing issues when using same
* macro names with different values
*******************************************************************************/
package org.eclipse.cdt.core.settings.model.util;
@ -19,14 +21,18 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.core.runtime.IPath;
/**
* Cache of setting entries stored with multidimentional maps.
* See bug 284699 comment 7 for a possible insight into it.
*/
public class CSettingEntryFactory {
private static final HashSet<IPath> EMPTY_SET = new HashSet<IPath>(0);
private KindBasedStore<HashMap<String, ?>> fStore = new KindBasedStore<HashMap<String, ?>>(false);
private <K, V> HashMap<String, HashMap<K, V>> getNameMap(int kind, boolean create, HashMap<K, V> type){
private <K, V> HashMap<String, HashMap<K, V>> getNameMap(int kind, boolean create){
@SuppressWarnings("unchecked")
HashMap<String, HashMap<K, V>> map = (HashMap<String, HashMap<K, V>>) fStore.get(kind);
HashMap<String/*name*/, HashMap<K, V>> map = (HashMap<String, HashMap<K, V>>) fStore.get(kind);
if(map == null && create){
map = new HashMap<String, HashMap<K, V>>();
fStore.put(kind, map);
@ -34,32 +40,32 @@ public class CSettingEntryFactory {
return map;
}
private <K, V> HashMap<K, V> getValueMap(String name, boolean create, HashMap<K, V> type){
HashMap<String, HashMap<K, V>> nameMap = getNameMap(ICSettingEntry.MACRO, create, (HashMap<K, V>)null);
private HashMap<String, HashMap<Integer, ICSettingEntry>> getValueMap(String name, boolean create){
HashMap<String/*name*/, HashMap<String/*value*/, HashMap<Integer/*flags*/, ICSettingEntry>>> nameMap = getNameMap(ICSettingEntry.MACRO, create);
if(nameMap != null){
return getMap(nameMap, name, create);
}
return null;
}
private HashMap<Integer, ICSettingEntry> getFlagMap(int kind, String name, String value, IPath[] exclusionPatters, boolean create){
private HashMap<Integer, ICSettingEntry> getFlagMap(int kind, String name, String value, IPath[] exclusionPatterns, boolean create){
switch(kind){
case ICSettingEntry.MACRO:
HashMap<String, HashMap<Integer, ICSettingEntry>> valueMap = getValueMap(name, create, (HashMap<String, HashMap<Integer, ICSettingEntry>>)null);
HashMap<String, HashMap<Integer, ICSettingEntry>> valueMap = getValueMap(name, create);
if(valueMap != null){
return getMap(valueMap, name, create);
return getMap(valueMap, value, create);
}
return null;
case ICSettingEntry.SOURCE_PATH:
case ICSettingEntry.OUTPUT_PATH:
HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> excPatternMap = getExclusionPatternsMap(kind, name, create);
if(excPatternMap != null){
HashSet<IPath> setKey = exclusionPatters == null || exclusionPatters.length == 0 ? EMPTY_SET : new HashSet<IPath>(Arrays.asList(exclusionPatters));
HashSet<IPath> setKey = exclusionPatterns == null || exclusionPatterns.length == 0 ? EMPTY_SET : new HashSet<IPath>(Arrays.asList(exclusionPatterns));
return getMap(excPatternMap, setKey, create);
}
return null;
default:
HashMap<String, HashMap<Integer, ICSettingEntry>> nameMap = getNameMap(kind, create, (HashMap<Integer, ICSettingEntry>)null);
HashMap<String, HashMap<Integer, ICSettingEntry>> nameMap = getNameMap(kind, create);
if(nameMap != null){
return getMap(nameMap, name, create);
}
@ -68,7 +74,7 @@ public class CSettingEntryFactory {
}
private HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> getExclusionPatternsMap(int kind, String name, boolean create){
HashMap<String, HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>>> nameMap = getNameMap(kind, create, (HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>>)null);
HashMap<String/*name*/, HashMap<HashSet<IPath>/*exclusionPatterns*/, HashMap<Integer/*flags*/, ICSettingEntry>>> nameMap = getNameMap(kind, create);
if(nameMap != null){
return getMap(nameMap, name, create);
}

View file

@ -1,691 +0,0 @@
//!Extract boolean comparison from if-condition.
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=check
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
bool check();
};
//@test.cpp
#include "test.h"
void Test::test() {
if (/*$*/5 == 3 + 2/*$$*/) {
//...
}
}
//=
#include "test.h"
bool Test::check() {
return 5 == 3 + 2;
}
void Test::test() {
if (check()) {
//...
}
}
//!Extract boolean comparison from if-condition with parameter.
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=check
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
bool check(int num);
};
//@test.cpp
#include "test.h"
void Test::test() {
int num = 1;
if (/*$*/5 != 3 + num/*$$*/) {
//...
}
}
//=
#include "test.h"
bool Test::check(int num) {
return 5 != 3 + num;
}
void Test::test() {
int num = 1;
if (check(num)) {
//...
}
}
//!Extract binary expression that results in a function with the same return type (BasicType) as the LHS.
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=add
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
int add(int five, int six);
};
//@test.cpp
#include "test.h"
void Test::test() {
int five = 5;
int six = 6;
int result = /*$*/five + six/*$$*/;
}
//=
#include "test.h"
int Test::add(int five, int six) {
return five + six;
}
void Test::test() {
int five = 5;
int six = 6;
int result = add(five, six);
}
//!Extract binary expression that results in a function with the same return type (ClassType) as the LHS
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=cat
//@test.h
struct helper {};
class Test {
void test();
};
//=
struct helper {};
class Test {
void test();
helper cat(helper s1, helper s2);
};
//@test.cpp
#include "test.h"
void Test::test() {
helper s1 = "a";
helper s2 = "b";
helper result = /*$*/s1 + s2/*$$*/;
}
//=
#include "test.h"
helper Test::cat(helper s1, helper s2) {
return s1 + s2;
}
void Test::test() {
helper s1 = "a";
helper s2 = "b";
helper result = cat(s1, s2);
}
//!Extract binary expression that results in a function with the same return type (Typedef) as the LHS
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=cat
//@test.h
struct helper {};
typedef helper new_helper;
class Test {
void test();
};
//=
struct helper {};
typedef helper new_helper;
class Test {
void test();
new_helper cat(new_helper s1, new_helper s2);
};
//@test.cpp
#include "test.h"
void Test::test() {
new_helper s1 = "a";
new_helper s2 = "b";
new_helper result = /*$*/s1 + s2/*$$*/;
}
//=
#include "test.h"
new_helper Test::cat(new_helper s1, new_helper s2) {
return s1 + s2;
}
void Test::test() {
new_helper s1 = "a";
new_helper s2 = "b";
new_helper result = cat(s1, s2);
}
//!Extract new-Expression
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=new_helper
//@test.cpp
struct helper {};
int main(int argc, char** argv) {
helper* h = /*$*/new helper/*$$*/;
return 0;
}
//=
struct helper {};
helper* new_helper() {
return new helper;
}
int main(int argc, char** argv) {
helper* h = new_helper();
return 0;
}
//!Extract function call
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=join_with_world
//@test.cpp
class string {};
string join(string s1, char* s2) {
return s1 + " " + s2;
}
int main() {
string hello = "Hello";
cout << /*$*/join(hello, "World")/*$$*/ << endl;
}
//=
class string {};
string join(string s1, char* s2) {
return s1 + " " + s2;
}
string join_with_world(string hello) {
return join(hello, "World");
}
int main() {
string hello = "Hello";
cout << join_with_world(hello) << endl;
}
//!Extract method call
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=value_from
//@test.cpp
struct other {
bool value() {}
};
class Klass {
void set(bool b) {
}
void test() {
other o;
this->set(/*$*/o.value()/*$$*/);
}
};
//=
struct other {
bool value() {}
};
class Klass {
void set(bool b) {
}
bool value_from(other o) {
return o.value();
}
void test() {
other o;
this->set(value_from(o));
}
};
//!Extract function call [we only have the declaration] that returns a pointer
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=has
//@test.cpp
class Cursor{};
Cursor* contains(const Cursor& pos);
int main() {
Cursor c;
contains(/*$*/contains(c)/*$$*/);
}
//=
class Cursor{};
Cursor* contains(const Cursor& pos);
Cursor* has(Cursor c) {
return contains(c);
}
int main() {
Cursor c;
contains(has(c));
}
//!Extract function call [we have the definition] that returns a pointer
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=has
//@test.cpp
class Cursor{};
Cursor* contains(const Cursor& pos) {
;
}
int main() {
Cursor c;
contains(/*$*/contains(c)/*$$*/);
}
//=
class Cursor{};
Cursor* contains(const Cursor& pos) {
;
}
Cursor* has(Cursor c) {
return contains(c);
}
int main() {
Cursor c;
contains(has(c));
}
//!Extract string constant
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=greeting
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
const char greeting();
};
//@test.cpp
#include "test.h"
void Test::test() {
char* hi = /*$*/"hello"/*$$*/;
}
//=
#include "test.h"
const char Test::greeting() {
return "hello";
}
void Test::test() {
char* hi = greeting();
}
//!Extract int constant
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=size
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
int size();
};
//@test.cpp
#include "test.h"
void Test::test() {
int i = /*$*/42/*$$*/;
}
//=
#include "test.h"
int Test::size() {
return 42;
}
void Test::test() {
int i = size();
}
//!Extract float constant
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=certainty
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
float certainty();
};
//@test.cpp
#include "test.h"
void Test::test() {
float f = /*$*/0.42f/*$$*/;
}
//=
#include "test.h"
float Test::certainty() {
return 0.42f;
}
void Test::test() {
float f = certainty();
}
//!Extract char constant
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=newline
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
char newline();
};
//@test.cpp
#include "test.h"
void Test::test() {
char nl = /*$*/'\n'/*$$*/;
}
//=
#include "test.h"
char Test::newline() {
return '\n';
}
void Test::test() {
char nl = newline();
}
//!Extract boolean true constant
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=valid
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
bool valid();
};
//@test.cpp
#include "test.h"
void Test::test() {
bool b = /*$*/true/*$$*/;
}
//=
#include "test.h"
bool Test::valid() {
return true;
}
void Test::test() {
bool b = valid();
}
//!Extract boolean false constant
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=invalid
//@test.h
class Test {
void test();
};
//=
class Test {
void test();
bool invalid();
};
//@test.cpp
#include "test.h"
void Test::test() {
bool b = /*$*/false/*$$*/;
}
//=
#include "test.h"
bool Test::invalid() {
return false;
}
void Test::test() {
bool b = invalid();
}
//!Extract expression with typedef Bug 331985
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=bar
//@test.cpp
typedef int& foo;
int test(foo s) {
int a = /*$*/s + 1/*$$*/; // type of id-expression 's' is int, not 'foo' or 'int&'
return a;
}
//=
typedef int& foo;
int bar(foo s) {
return s + 1;
}
int test(foo s) {
int a = bar(s); // type of id-expression 's' is int, not 'foo' or 'int&'
return a;
}
//!Bug 260133 Extract function and extract local variable don't handle type promotion
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=bar
//@test.cpp
void foo() {
int x = 3;
double y = /*$*/x + 2.5/*$$*/;
}
//=
double bar(int x) {
return x + 2.5;
}
void foo() {
int x = 3;
double y = bar(x);
}
//! Extract macro
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
filename=test.cpp
methodname=bar
//@test.cpp
#define five 5
#define ADD(a, b) a + b
int main() {
int i = five; //comment3
i = /*$*/ADD(i, five)/*$$*/;
return i;
}
//=
#define five 5
#define ADD(a, b) a + b
int bar(int i) {
return ADD(i, five);
}
int main() {
int i = five; //comment3
i = bar(i);
return i;
}

View file

@ -1,93 +0,0 @@
//!Extract template function
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.cpp
void test() {
}
template<typename T>
int tempFunct() {
T i;
i = 0;
/*$*/i++;
i += 3;/*$$*/
return 0;
}
//=
void test() {
}
template<typename T>
void exp(T i) {
i++;
i += 3;
}
template<typename T>
int tempFunct() {
T i;
i = 0;
exp(i);
return 0;
}
//!Extract template function with template parameter Bug #12
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.cpp
void test() {
}
template<typename T>
int tempFunct(T p) {
/*$*/++p;
p + 4;/*$$*/
return 0;
}
//=
void test() {
}
template<typename T>
void exp(T p) {
++p;
p + 4;
}
template<typename T>
int tempFunct(T p) {
exp(p);
return 0;
}
//!Extract template function with template type declaration Bug #11
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.cpp
void test() {
}
template<typename T>
int tempFunct() {
/*$*/T p;
p = 0;
p + 4;/*$$*/
p + 2;
return 0;
}
//=
void test() {
}
template<typename T>
T exp() {
T p;
p = 0;
p + 4;
return p;
}
template<typename T>
int tempFunct() {
T p = exp();
p + 2;
return 0;
}

View file

@ -1,987 +0,0 @@
//!Extract method with duplicates
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& i);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
++i;
help();
}
int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
exp(i);
}
void A::exp(int& i) {
++i;
help();
}
int A::foo() {
int i = 2;
exp(i);
return i;
}
int A::help() {
return 42;
}
//!Extract method duplicates with different Names
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& i);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
++oo;
help();
}
int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
exp(oo);
}
void A::exp(int& i) {
++i;
help();
}
int A::foo() {
int i = 2;
exp(i);
return i;
}
int A::help() {
return 42;
}
//!Extract method duplicate with field
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
returnvalue=j
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
void foo();
int i;
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
void foo();
int i;
private:
int help();
int exp(int j, int& a);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int j = 0;
i++;
j++;
help();
}
void A::foo() {
int j = 0;
int a = 1;
/*$*/j++;
a++;
help();/*$$*/
a++;
j++;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int j = 0;
i = exp(i, j);
}
int A::exp(int j, int& a) {
j++;
a++;
help();
return j;
}
void A::foo() {
int j = 0;
int a = 1;
j = exp(j, a);
a++;
j++;
}
int A::help() {
return 42;
}
//!Extract method duplicate with field in marked scope
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
returnvalue=j
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
void foo();
int i;
int field;
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
void foo();
int i;
int field;
private:
int help();
int exp(int j);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int j = 0;
int a = 1;
a++;
j++;
help();
}
void A::foo() {
int j = 0;
/*$*/field++;
j++;
help();/*$$*/
field++;
j++;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int j = 0;
int a = 1;
a++;
j++;
help();
}
int A::exp(int j) {
field++;
j++;
help();
return j;
}
void A::foo() {
int j = 0;
j = exp(j);
field++;
j++;
}
int A::help() {
return 42;
}
//!Extract method duplicates with different names and return type
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
returnvalue=i
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
int exp(int i, float& j);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
float blabla = 0;
++oo;
blabla += 1;
help();
blabla += 1;
}
int A::foo() {
int i = 2;
float j = 8989;
/*$*/++i;
j+=1;
help();/*$$*/
j++;
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
float blabla = 0;
oo = exp(oo, blabla);
blabla += 1;
}
int A::exp(int i, float& j) {
++i;
j += 1;
help();
return i;
}
int A::foo() {
int i = 2;
float j = 8989;
i = exp(i, j);
j++;
return i;
}
int A::help() {
return 42;
}
//!Extract method duplicates with a lot of different Names an variable not used afterwards in the duplicate
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& i, float j);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
float blabla = 0;
++oo;
blabla += 1;
help();
}
int A::foo() {
int i = 2;
float j = 8989;
/*$*/++i;
j+=1;
help();/*$$*/
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
float blabla = 0;
exp(oo, blabla);
}
void A::exp(int& i, float j) {
++i;
j += 1;
help();
}
int A::foo() {
int i = 2;
float j = 8989;
exp(i, j);
return i;
}
int A::help() {
return 42;
}
//!Extract method with duplicate name used afterwards in duplicate but not in original selection this is no duplicate
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
void foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
void foo();
private:
int help();
void exp(int i);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
++i;// No Duplicate
help();
++i;// this is the reason
}
void A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
++i;// No Duplicate
help();
++i;// this is the reason
}
void A::exp(int i) {
++i;
help();
}
void A::foo() {
int i = 2;
exp(i);
}
int A::help() {
return 42;
}
//!Extract method with return value and a lot ref parameter and a method call
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
returnvalue=i
//@A.h
#ifndef A_H_
#define A_H_
#include "B.h"
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
#include "B.h"
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
int exp(int i, B* b, int y, float x);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
++i;
b->hello(y);
i = i + x;
help();
b->hello(y);
++x;
i++;
}
int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
/*$*/++i;
b->hello(y);
i = i + x;
help();/*$$*/
b->hello(y);
++x;
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
i = exp(i, b, y, x);
b->hello(y);
++x;
i++;
}
int A::exp(int i, B* b, int y, float x) {
++i;
b->hello(y);
i = i + x;
help();
return i;
}
int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
i = exp(i, b, y, x);
b->hello(y);
++x;
return i;
}
int A::help() {
return 42;
}
//@B.h
#ifndef B_H_
#define B_H_
class B {
public:
B();
virtual ~B();
void hello(float y);
};
#endif /*B_H_*/
//!Extract method with return value and a lot ref parameter and a method call, duplicate is similar
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
returnvalue=i
//@A.h
#ifndef A_H_
#define A_H_
#include "B.h"
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
#include "B.h"
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
int exp(int i, B* b, int y, float x);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
++i;
b->hello(y);
i = i + x;
help();
b->hello(y);
++x;
i++;
}
int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
/*$*/++i;
b->hello(y);
i = i + x;
help();/*$$*/
b->hello(y);
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
i = exp(i, b, y, x);
b->hello(y);
++x;
i++;
}
int A::exp(int i, B* b, int y, float x) {
++i;
b->hello(y);
i = i + x;
help();
return i;
}
int A::foo() {
int i = 2;
float x = i;
B* b = new B();
int y = x + i;
i = exp(i, b, y, x);
b->hello(y);
return i;
}
int A::help() {
return 42;
}
//@B.h
#ifndef B_H_
#define B_H_
class B {
public:
B();
virtual ~B();
void hello(float y);
};
#endif /*B_H_*/
//!Extract method with duplicates and comments
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
replaceduplicates=true
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& i);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
++i;
help();
}
int A::foo() {
int i = 2;
/*$*/++i;
help();/*$$*/
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int i = 2;
exp(i);
}
void A::exp(int& i) {
++i;
help();
}
int A::foo() {
int i = 2;
exp(i);
return i;
}
int A::help() {
return 42;
}

View file

@ -1,333 +0,0 @@
//!ExtractFunctionHistoryRefactoringTest variable defined in scope
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
int exp();
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
}
int A::foo() {
int i = 2;
++i;
help();
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
}
int A::exp() {
int i = 2;
++i;
help();
return i;
}
int A::foo() {
int i = exp();
return i;
}
int A::help() {
return 42;
}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/A.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
name="exp" project="RegressionTestProject" selection="57,25" visibility="private"/>
</session>
//!ExtractFunctionHistoryRefactoringTest
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& i);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
}
int A::foo() {
int i = 2;
//comment
++i;
help();
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
}
void A::exp(int& i) {
//comment
++i;
help();
}
int A::foo() {
int i = 2;
//comment
exp(i);
return i;
}
int A::help() {
return 42;
}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/A.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
name="exp" project="RegressionTestProject" selection="69,24" visibility="private"/>
</session>
//!Extract Function History first extracted statement with leading comment
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@main.cpp
int main() {
int i;
// Comment
i = 7;
return i;
}
//=
void exp(int& i) {
// Comment
i = 7;
}
int main() {
int i;
// Comment
exp(i);
return i;
}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/main.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
name="exp" project="RegressionTestProject" selection="34,6" visibility="private"/>
</session>
//!Extract Function History extracted statement with trailing comment
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@main.cpp
int main() {
int i;
i = 7; // Comment
return i;
}
//=
void exp(int& i) {
i = 7; // Comment
}
int main() {
int i;
exp(i);
return i;
}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/main.cpp"
flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
name="exp" project="RegressionTestProject" selection="22,6" visibility="private"/>
</session>
//!ExtractFunctionRefactoringTest duplicates with different Names History Test
//#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& i);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
++oo;
help();
}
int A::foo() {
int i = 2;
++i;
help();
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
A::A() {
}
A::~A() {
int oo = 99;
exp(oo);
}
void A::exp(int& i) {
++i;
help();
}
int A::foo() {
int i = 2;
exp(i);
return i;
}
int A::help() {
return 42;
}
//@refScript.xml
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring comment="Create method exp" description="Extract Method Refactoring"
fileName="file:$$projectPath$$/A.cpp" flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
name="exp" project="RegressionTestProject" replaceDuplicates="true" selection="99,13" visibility="private"/>
</session>

View file

@ -1,262 +0,0 @@
//!ExtractFunctionRefactoringTest with FunctionStyleMacro2
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
void exp(int& ii);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
#define ADD(a,ab) a + ab + 2 + a
A::A() {
}
A::~A() {
}
int A::foo() {
int ii = 2;
/*$*/++ii;
ii = ADD(ii, 42);
help();/*$$*/
return ii;
}
int A::help() {
return 42;
}
//=
#include "A.h"
#define ADD(a,ab) a + ab + 2 + a
A::A() {
}
A::~A() {
}
void A::exp(int& ii) {
++ii;
ii = ADD(ii, 42);
help();
}
int A::foo() {
int ii = 2;
exp(ii);
return ii;
}
int A::help() {
return 42;
}
//!Extract method return value assigned to macro call
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
returnvalue=b
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
int exp(int& i, int b);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
#define ADD(b) b = b + 2
A::A() {
}
A::~A() {
}
int A::foo() {
int i = 2;
int b = 42;
/*$*/++i;
help();
ADD(b);/*$$*/
b += 2;
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
#define ADD(b) b = b + 2
A::A() {
}
A::~A() {
}
int A::exp(int& i, int b) {
++i;
help();
ADD(b);
return b;
}
int A::foo() {
int i = 2;
int b = 42;
b = exp(i, b);
b += 2;
return i;
}
int A::help() {
return 42;
}
//!Extract method with multiple macros
//#org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest
//@.config
returnvalue=bb
replaceduplicates=true
//@A.h
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
};
#endif /*A_H_*/
//=
#ifndef A_H_
#define A_H_
class A {
public:
A();
virtual ~A();
int foo();
private:
int help();
int exp(int bb);
};
#endif /*A_H_*/
//@A.cpp
#include "A.h"
#define ADD(b) b = b + 2
A::A() {
}
A::~A() {
}
int A::foo() {
int i = 2;
int bb = 42;
++i;
/*$*/ADD(bb);
ADD(bb);/*$$*/
bb += 2;
return i;
}
int A::help() {
return 42;
}
//=
#include "A.h"
#define ADD(b) b = b + 2
A::A() {
}
A::~A() {
}
int A::exp(int bb) {
ADD(bb);
ADD(bb);
return bb;
}
int A::foo() {
int i = 2;
int bb = 42;
++i;
bb = exp(bb);
bb += 2;
return i;
}
int A::help() {
return 42;
}

View file

@ -17,7 +17,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
import org.eclipse.cdt.core.tests.BaseTestFramework;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
@ -25,10 +24,14 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.cdt.core.tests.BaseTestFramework;
/**
* Don't create new tests based on this class. Use RefactoringTestBase instead.
*
* @author Guido Zgraggen IFS
*/
public abstract class RefactoringBaseTest extends BaseTestFramework implements ILogListener{
public abstract class RefactoringBaseTest extends BaseTestFramework implements ILogListener {
protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
protected TreeMap<String, TestSourceFile> fileMap = new TreeMap<String, TestSourceFile>();
@ -49,7 +52,6 @@ public abstract class RefactoringBaseTest extends BaseTestFramework implements I
@Override
protected abstract void runTest() throws Throwable;
@Override
protected void setUp() throws Exception {
super.setUp();
@ -96,10 +98,10 @@ public abstract class RefactoringBaseTest extends BaseTestFramework implements I
@Override
public void logging(IStatus status, String plugin) {
Throwable ex = status.getException();
StringBuffer stackTrace = new StringBuffer();
if(ex != null) {
StringBuilder stackTrace = new StringBuilder();
if (ex != null) {
stackTrace.append('\n');
for(StackTraceElement ste : ex.getStackTrace()) {
for (StackTraceElement ste : ex.getStackTrace()) {
stackTrace.append(ste.toString());
}
}

View file

@ -8,6 +8,7 @@
*
* Contributors:
* Institute for Software (IFS)- initial API and implementation
* Sergey Prigogin (Google)
******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring;
@ -18,18 +19,18 @@ import java.util.Properties;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory;
import org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService;
import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest;
/**
* @author Emanuel Graf IFS
*/
public class RefactoringHistoryTest extends ExtractFunctionRefactoringTest {
public class RefactoringHistoryTest extends RefactoringTest {
private TestSourceFile scriptFile;
public RefactoringHistoryTest(String name, Collection<TestSourceFile> files) {
@ -64,4 +65,12 @@ public class RefactoringHistoryTest extends ExtractFunctionRefactoringTest {
}
}
}
protected void executeRefactoring(Refactoring refactoring) throws Exception {
RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
assertConditionsOk(finalConditions);
Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);
createChange.perform(NULL_PROGRESS_MONITOR);
compareFiles(fileMap);
}
}

View file

@ -35,6 +35,7 @@ public abstract class RefactoringTest extends RefactoringBaseTest {
protected String fileName;
protected RefactoringASTCache astCache;
protected boolean fatalError;
public RefactoringTest(String name, Collection<TestSourceFile> files) {
super(name, files);

View file

@ -0,0 +1,318 @@
/*******************************************************************************
* Copyright (c) 2012 Google, Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.URI;
import java.util.LinkedHashSet;
import java.util.Set;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory;
import org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService;
import org.osgi.framework.Bundle;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
import org.eclipse.cdt.ui.testplugin.CTestPlugin;
import org.eclipse.cdt.internal.ui.refactoring.RefactoringASTCache;
/**
* Common base for refactoring tests.
*/
public abstract class RefactoringTestBase extends BaseTestCase {
private static final int INDEXER_TIMEOUT_SEC = 360;
protected static final NullProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
private boolean cpp = true;
private RefactoringASTCache astCache;
private ICProject cproject;
private final Set<TestSourceFile> testFiles = new LinkedHashSet<TestSourceFile>();
private TestSourceFile selectedFile;
private TextSelection selection;
private TestSourceFile historyScript;
protected RefactoringTestBase() {
super();
}
protected RefactoringTestBase(String name) {
super(name);
}
@Override
public void setUp() throws Exception {
super.setUp();
cproject = cpp ?
CProjectHelper.createCCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER) :
CProjectHelper.createCProject(getName() + System.currentTimeMillis(), "bin", IPDOMManager.ID_NO_INDEXER);
Bundle bundle = CTestPlugin.getDefault().getBundle();
CharSequence[] testData = TestSourceReader.getContentsForTest(bundle, "ui", getClass(), getName(), 0);
for (int i = 0; i < testData.length; i++) {
CharSequence contents = testData[i];
TestSourceFile testFile = null;
boolean expectedResult = false;
BufferedReader reader = new BufferedReader(new StringReader(contents.toString()));
String line;
while ((line = reader.readLine()) != null) {
if (testFile == null) {
testFile = new TestSourceFile(line.trim());
} else if (isResultDelimiter(line.trim())) {
expectedResult = true;
} else if (expectedResult) {
testFile.addLineToExpectedSource(line);
} else {
testFile.addLineToSource(line);
}
}
reader.close();
if (!testFile.getSource().isEmpty()) {
TestSourceReader.createFile(cproject.getProject(), new Path(testFile.getName()),
testFile.getSource());
}
testFiles.add(testFile);
if (testFile.getName().endsWith(".xml")) {
historyScript = testFile;
} else if (selection == null) {
selection = testFile.getSelection();
if (selection != null)
selectedFile = testFile;
}
}
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
assertTrue(CCorePlugin.getIndexManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000,
NULL_PROGRESS_MONITOR));
astCache = new RefactoringASTCache();
}
@Override
public void tearDown() throws Exception {
astCache.dispose();
if (cproject != null) {
cproject.getProject().delete(IResource.FORCE | IResource.ALWAYS_DELETE_PROJECT_CONTENT,
NULL_PROGRESS_MONITOR);
}
super.tearDown();
}
protected void assertRefactoringSuccess() throws Exception {
executeRefactoring(true);
compareFiles();
}
protected void assertRefactoringFailure() throws Exception {
executeRefactoring(false);
}
private void executeRefactoring(boolean expectedSuccess) throws Exception {
if (historyScript != null) {
executeHistoryRefactoring(expectedSuccess);
return;
}
Refactoring refactoring = createRefactoring();
executeRefactoring(refactoring, true, expectedSuccess);
}
protected void executeRefactoring(Refactoring refactoring, boolean withUserInput,
boolean expectedSuccess) throws CoreException, Exception {
RefactoringStatus initialStatus = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
if (!expectedSuccess) {
assertStatusFatalError(initialStatus);
return;
}
assertStatusOk(initialStatus);
if (withUserInput)
simulateUserInput();
RefactoringStatus finalStatus = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
assertStatusOk(finalStatus);
Change change = refactoring.createChange(NULL_PROGRESS_MONITOR);
change.perform(NULL_PROGRESS_MONITOR);
}
private void executeHistoryRefactoring(boolean expectedSuccess) throws Exception {
URI uri= URIUtil.toURI(cproject.getProject().getLocation());
String scriptSource = historyScript.getSource().replaceAll("\\$\\{projectPath\\}", uri.getPath());
RefactoringHistory history = RefactoringHistoryService.getInstance().readRefactoringHistory(
new ByteArrayInputStream(scriptSource.getBytes()), 0);
for (RefactoringDescriptorProxy proxy : history.getDescriptors()) {
RefactoringStatus status = new RefactoringStatus();
Refactoring refactoring =
proxy.requestDescriptor(NULL_PROGRESS_MONITOR).createRefactoring(status);
assertTrue(status.isOK());
executeRefactoring(refactoring, false, expectedSuccess);
}
}
/**
* Creates a refactoring object.
*/
protected abstract Refactoring createRefactoring();
/**
* Subclasses can override to simulate user input.
*/
protected void simulateUserInput() {
}
protected ICProject getCProject() {
return cproject;
}
protected TestSourceFile getSelectedTestFile() {
return selectedFile;
}
protected IFile getSelectedFile() {
if (selectedFile == null)
return null;
return cproject.getProject().getFile(new Path(selectedFile.getName()));
}
protected TestSourceFile getHistoryScriptFile() {
return historyScript;
}
protected TextSelection getSelection() {
return selection;
}
protected boolean isCpp() {
return cpp;
}
protected void setCpp(boolean cpp) {
this.cpp = cpp;
}
private boolean isResultDelimiter(String str) {
if (str.isEmpty())
return false;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) != '=')
return false;
}
return true;
}
protected void assertStatusOk(RefactoringStatus status) {
if (!status.isOK())
fail("Error or warning status: " + status.getEntries()[0].getMessage());
}
protected void assertStatusWarning(RefactoringStatus status, int number) {
if (number > 0) {
assertTrue("Warning status expected", status.hasWarning());
}
RefactoringStatusEntry[] entries = status.getEntries();
int count = 0;
for (RefactoringStatusEntry entry : entries) {
if (entry.isWarning()) {
++count;
}
}
assertEquals("Found " + count + " warnings instead of expected " + number, number, count);
}
protected void assertStatusInfo(RefactoringStatus status, int number) {
if (number > 0) {
assertTrue("Info status expected", status.hasInfo());
}
RefactoringStatusEntry[] entries = status.getEntries();
int count = 0;
for (RefactoringStatusEntry entry : entries) {
if (entry.isInfo()) {
++count;
}
}
assertEquals("Found " + count + " informational messages instead of expected " + number, number, count);
}
protected void assertStatusError(RefactoringStatus status, int number) {
if (number > 0) {
assertTrue("Error status expected", status.hasError());
}
RefactoringStatusEntry[] entries = status.getEntries();
int count = 0;
for (RefactoringStatusEntry entry : entries) {
if (entry.isError()) {
++count;
}
}
assertEquals("Found " + count + " errors instead of expected " + number, number, count);
}
protected void assertStatusFatalError(RefactoringStatus status, int number) {
if (number > 0) {
assertTrue("Fatal error status expected", status.hasFatalError());
}
RefactoringStatusEntry[] entries = status.getEntries();
int count = 0;
for (RefactoringStatusEntry entry : entries) {
if (entry.isFatalError()) {
++count;
}
}
assertEquals("Found " + count + " fatal errors instead of expected " + number, number, count);
}
protected void assertStatusFatalError(RefactoringStatus status) {
assertTrue("Fatal error status expected", status.hasFatalError());
}
protected void assertEquals(TestSourceFile testFile, IFile file) throws Exception {
String actualSource = getFileContents(file);
assertEquals(testFile.getExpectedSource(), actualSource);
}
protected void compareFiles() throws Exception {
for (TestSourceFile testFile : testFiles) {
String expectedSource = testFile.getExpectedSource();
IFile file = cproject.getProject().getFile(new Path(testFile.getName()));
String actualSource = getFileContents(file);
assertEquals(expectedSource, actualSource);
}
}
protected String getFileContents(IFile file) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()));
StringBuilder code = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
code.append(line);
code.append('\n');
}
reader.close();
return code.toString();
}
}

View file

@ -9,6 +9,7 @@
* Contributors:
* Institute for Software - initial API and implementation
* Tom Ball (Google)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring;
@ -16,7 +17,7 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.ui.tests.refactoring.extractconstant.ExtractConstantTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest;
import org.eclipse.cdt.ui.tests.refactoring.extractlocalvariable.ExtractLocalVariableTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.gettersandsetters.GenerateGettersAndSettersTestSuite;
import org.eclipse.cdt.ui.tests.refactoring.hidemethod.HideMethodTestSuite;
@ -34,7 +35,7 @@ public class RefactoringTestSuite extends TestSuite {
TestSuite suite = new RefactoringTestSuite();
suite.addTest(UtilTestSuite.suite());
suite.addTest(RenameRegressionTests.suite());
suite.addTest(ExtractFunctionTestSuite.suite());
suite.addTest(ExtractFunctionRefactoringTest.suite());
suite.addTest(ExtractConstantTestSuite.suite());
suite.addTest(HideMethodTestSuite.suite());
suite.addTest(GenerateGettersAndSettersTestSuite.suite());

View file

@ -8,6 +8,7 @@
*
* Contributors:
* Institute for Software - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring;
@ -18,71 +19,77 @@ import org.eclipse.jface.text.TextSelection;
/**
* @author Emanuel Graf
*
*/
public class TestSourceFile {
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final String LINE_SEPARATOR = "\n"; //$NON-NLS-1$
private static final Pattern SELECTION_START = Pattern.compile("/\\*\\$\\*/"); //$NON-NLS-1$
private static final Pattern SELECTION_END = Pattern.compile("/\\*\\$\\$\\*/"); //$NON-NLS-1$
private static final String REPLACEMENT = ""; //$NON-NLS-1$
private String name;
private StringBuffer source = new StringBuffer();
private StringBuffer expectedSource = new StringBuffer();
private String separator = "\n"; //$NON-NLS-1$
private final String name;
private final StringBuilder source = new StringBuilder();
private final StringBuilder expectedSource = new StringBuilder();
private int selectionStart = -1;
private int selectionEnd = -1;
protected static final String selectionStartRegex = "/\\*\\$\\*/"; //$NON-NLS-1$
protected static final String selectionEndRegex = "/\\*\\$\\$\\*/"; //$NON-NLS-1$
protected static final String selectionStartLineRegex = "(.*)(" + selectionStartRegex + ")(.*)"; //$NON-NLS-1$ //$NON-NLS-2$
protected static final String selectionEndLineRegex = "(.*)("+ selectionEndRegex + ")(.*)"; //$NON-NLS-1$ //$NON-NLS-2$
public TestSourceFile(String name) {
super();
this.name = name;
}
public String getExpectedSource() {
String exp = expectedSource.toString();
if(exp.length() == 0) {
return getSource();
}else {
return exp;
}
}
public String getName() {
return name;
}
public String getSource() {
return source.toString();
}
public void addLineToSource(String code) {
Matcher start = createMatcherFromString(selectionStartLineRegex, code);
if(start.matches()) {
selectionStart = start.start(2) + source.length();
code = code.replaceAll(selectionStartRegex, REPLACEMENT);
public String getExpectedSource() {
if (expectedSource.length() == 0) {
return getSource();
}
Matcher end = createMatcherFromString(selectionEndLineRegex, code);
if(end.matches()) {
selectionEnd = end.start(2) + source.length();
code = code.replaceAll(selectionEndRegex, REPLACEMENT);
return expectedSource.toString();
}
public void addLineToSource(String code) {
Matcher start = SELECTION_START.matcher(code);
if (start.find()) {
selectionStart = start.start() + source.length();
code = start.replaceAll(EMPTY_STRING);
}
Matcher end = SELECTION_END.matcher(code);
if (end.find()) {
selectionEnd = end.start() + source.length();
code = end.replaceAll(EMPTY_STRING);
}
source.append(code);
source.append(separator);
source.append(LINE_SEPARATOR);
}
public void addLineToExpectedSource(String code) {
expectedSource.append(code);
expectedSource.append(separator);
expectedSource.append(LINE_SEPARATOR);
}
public TextSelection getSelection() {
if(selectionStart < 0 || selectionEnd <0 ) {
if (selectionStart < 0 || selectionEnd < selectionStart)
return null;
}else {
return new TextSelection(selectionStart, selectionEnd -selectionStart);
}
return new TextSelection(selectionStart, selectionEnd - selectionStart);
}
protected static Matcher createMatcherFromString(String pattern, String line) {
return Pattern.compile(pattern).matcher(line);
@Override
public int hashCode() {
return name.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
TestSourceFile other = (TestSourceFile) obj;
return name.equals(other.name);
}
}

View file

@ -1,35 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Institute for Software - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.extractfunction;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
/**
* @author Emanuel Graf
*/
public class ExtractFunctionTestSuite extends TestSuite {
@SuppressWarnings("nls")
public static Test suite() throws Exception {
TestSuite suite = new ExtractFunctionTestSuite();
suite.addTest(RefactoringTester.suite("ExtractMethod.rts", "resources/refactoring/ExtractMethod.rts"));
suite.addTest(RefactoringTester.suite("ExtractExpression.rts", "resources/refactoring/ExtractExpression.rts"));
suite.addTest(RefactoringTester.suite("ExtractMethodPreprocessor.rts", "resources/refactoring/ExtractMethodPreprocessor.rts"));
suite.addTest(RefactoringTester.suite("ExtractFunctionTemplates.rts", "resources/refactoring/ExtractFunctionTemplates.rts"));
suite.addTest(RefactoringTester.suite("ExtractMethodHistory.rts", "resources/refactoring/ExtractMethodHistory.rts"));
suite.addTest(RefactoringTester.suite("ExtractFunctionDuplicates.rts", "resources/refactoring/ExtractMethodDuplicates.rts"));
return suite;
}
}

View file

@ -632,3 +632,6 @@ transfer.EditorBehavior.description = Preference related to how the editor proce
RefreshExclusionContributor.name = Resources
extension-point.name = Refresh Exclusion Contributor
# New New Project Wizard
newProjectWizard.name = C/C++ Project (new)

View file

@ -455,6 +455,17 @@
%Cproject.desc
</description>
</wizard>
<wizard
canFinishEarly="false"
category="org.eclipse.cdt.ui.newCWizards"
class="org.eclipse.cdt.ui.wizards.NewCDTProjectWizard"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
hasPages="true"
icon="icons/elcl16/newmngc_app.gif"
id="org.eclipse.cdt.ui.wizards.newProject"
name="%newProjectWizard.name"
project="true">
</wizard>
</extension>
<!-- Define the document setup participant for the C/C++ and Assembly Editors -->

View file

@ -1241,7 +1241,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
if (IndexerPreferences.KEY_INDEX_ON_OPEN.equals(event.getKey())) {
ICElement element= getInputCElement();
ITranslationUnit tu = element != null ? (ITranslationUnit) element : null;
updateIndexInclusion(tu, false);
updateIndexInclusion(tu);
}
}
@ -1520,32 +1520,25 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
if (element instanceof ITranslationUnit) {
ITranslationUnit tu = (ITranslationUnit) element;
updateIndexInclusion(tu, false);
updateIndexInclusion(tu);
fBracketMatcher.configure(tu.getLanguage());
} else {
updateIndexInclusion(null, false);
updateIndexInclusion(null);
fBracketMatcher.configure(null);
}
}
private void updateIndexInclusion(ITranslationUnit tu, boolean synchronous) {
if (tu!= null) {
private void updateIndexInclusion(ITranslationUnit tu) {
if (tu != null) {
IProject project = tu.getCProject().getProject();
if (!String.valueOf(true).equals(IndexerPreferences.get(project, IndexerPreferences.KEY_INDEX_ON_OPEN, null))) {
tu = null;
}
}
if (tu != null || fTuAddedToIndex != null) {
if ((tu != null || fTuAddedToIndex != null) && tu != fTuAddedToIndex) {
IndexUpdateRequestorJob job = new IndexUpdateRequestorJob(tu, fTuAddedToIndex);
fTuAddedToIndex = tu;
job.schedule();
if (synchronous) {
try {
job.join();
} catch (InterruptedException e) {
// Ignore.
}
}
}
}
@ -2215,7 +2208,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
@Override
public void dispose() {
fIndexerPreferenceListener.unregister();
updateIndexInclusion(null, true);
updateIndexInclusion(null);
ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer instanceof ITextViewerExtension)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -233,6 +233,14 @@ public abstract class AbstractCompareViewerInformationControl extends org.eclips
}
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (!visible) {
setInput(null);
}
}
@Override
public void dispose() {
if (!fIsSystemBackgroundColor) {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -199,9 +199,10 @@ class CMacroCompareViewer extends CMergeViewer {
fLeftViewer.setRedraw(false);
fRightViewer.setRedraw(false);
}
final ReplaceEdit[] edits;
ReplaceEdit[] edits = null;
try {
if (fInput != null) {
final IMacroExpansionStep step;
if (fStepIndex < fInput.fExplorer.getExpansionStepCount()) {
step= fInput.fExplorer.getExpansionStep(fStepIndex);
@ -212,7 +213,7 @@ class CMacroCompareViewer extends CMergeViewer {
fLeftHighlighter.setReplaceEdits(fPrefixLength, edits);
fRightHighlighter.setReplaceEdits(fPrefixLength, edits);
}
super.setInput(input);
} finally {
@ -221,7 +222,7 @@ class CMacroCompareViewer extends CMergeViewer {
fRightViewer.setRedraw(true);
}
}
if (edits.length > 0) {
if (edits != null && edits.length > 0) {
if (fLeftViewer != null && fRightViewer != null) {
final int firstDiffOffset= fPrefixLength + edits[0].getOffset();
fLeftViewer.revealRange(firstDiffOffset, edits[0].getLength());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -64,10 +64,19 @@ public class CMacroExpansionControl extends AbstractSourceViewerInformationContr
fInput= macroExpansionInput;
updateStatusText();
} else {
fInput = null;
super.setInput(input);
}
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (!visible) {
setInput(null);
}
}
private void updateStatusText() {
if (fInput == null) {
return;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -450,11 +450,14 @@ public class CMacroExpansionExplorationControl extends AbstractCompareViewerInfo
public void setInput(Object input) {
if (input instanceof CMacroExpansionInput) {
setMacroExpansionInput((CMacroExpansionInput) input);
} else {
} else if (input != null) {
if (fMacroCompareViewer != null) {
fMacroCompareViewer.setMacroExpansionStep(fIndex);
}
super.setInput(input);
} else {
setMacroExpansionInput(null);
super.setInput(input);
}
}
@ -507,6 +510,9 @@ public class CMacroExpansionExplorationControl extends AbstractCompareViewerInfo
*/
private void setMacroExpansionInput(CMacroExpansionInput input) {
fInput= input;
if (fMacroCompareViewer != null) {
fMacroCompareViewer.setMacroExpansionInput(input);
}
if (fInput != null) {
fIndex= fixIndex(input.fStartWithFullExpansion ? getStepCount() : 0);
showExpansion();

View file

@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Doug Schaefer - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.wizards;
import org.eclipse.osgi.util.NLS;
class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.ui.wizards.messages"; //$NON-NLS-1$
public static String NewCDTProjectWizard_mainPageDesc;
public static String NewCDTProjectWizard_mainPageTitle;
public static String NewCDTProjectWizard_refPageDesc;
public static String NewCDTProjectWizard_refPageTitle;
public static String NewCDTProjectWizard_templatePageDesc;
public static String NewCDTProjectWizard_templatePageTitle;
public static String NewCDTProjectWizard_windowTitle;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View file

@ -0,0 +1,84 @@
package org.eclipse.cdt.ui.wizards;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
/**
* This is the new CDT project wizard.
*
* Without subclassing, it is in it's most generic form.
*
* Subclasses can filter or select the languages and add template filters.
*
* @author Doug Schaefer
* @since 5.4
*/
public class NewCDTProjectWizard extends Wizard implements INewWizard {
private IStructuredSelection selection;
private WizardNewProjectCreationPage mainPage;
private TemplateSelectionPage templatePage;
private WizardNewProjectReferencePage referencePage;
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.selection = selection;
setNeedsProgressMonitor(true);
setWindowTitle(Messages.NewCDTProjectWizard_windowTitle);
}
@Override
public boolean performFinish() {
return true;
}
@Override
public void addPages() {
super.addPages();
mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
@Override
public void createControl(Composite parent) {
super.createControl(parent);
createWorkingSetGroup(
(Composite) getControl(),
selection,
new String[] { "org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$
"org.eclipse.cdt.ui.CElementWorkingSetPage" }); //$NON-NLS-1$
Dialog.applyDialogFont(getControl());
}
};
mainPage.setTitle(Messages.NewCDTProjectWizard_mainPageTitle);
mainPage.setDescription(Messages.NewCDTProjectWizard_mainPageDesc);
addPage(mainPage);
templatePage = new TemplateSelectionPage();
templatePage.setTitle(Messages.NewCDTProjectWizard_templatePageTitle);
templatePage.setDescription(Messages.NewCDTProjectWizard_templatePageDesc);
addPage(templatePage);
// only add page if there are already projects in the workspace
if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) {
referencePage = new WizardNewProjectReferencePage(
"basicReferenceProjectPage");//$NON-NLS-1$
referencePage.setTitle(Messages.NewCDTProjectWizard_refPageTitle);
referencePage
.setDescription(Messages.NewCDTProjectWizard_refPageDesc);
this.addPage(referencePage);
}
}
@Override
public boolean canFinish() {
// TODO make sure we have everything in place first.
return false;
}
}

View file

@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2012 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Doug Schaefer - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.wizards;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.List;
import org.eclipse.cdt.ui.templateengine.Template;
import org.eclipse.cdt.ui.templateengine.TemplateEngineUI;
/**
* @author Dad
* @since 5.4
*/
public class TemplateSelectionPage extends WizardPage {
public TemplateSelectionPage() {
super("templateSelection"); //$NON-NLS-1$
}
@Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout(1, false));
List templateList = new List(comp, SWT.BORDER);
templateList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Template[] templates = TemplateEngineUI.getDefault().getTemplates();
for (Template template : templates) {
templateList.add(template.getLabel());
}
setControl(comp);
}
@Override
public boolean isPageComplete() {
return true;
}
}

View file

@ -0,0 +1,17 @@
#################################################################################
# Copyright (c) 2012 Wind River Systems and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Doug Schaefer - initial API and implementation
#################################################################################
NewCDTProjectWizard_mainPageDesc=Create a new C/C++ Project
NewCDTProjectWizard_mainPageTitle=Project
NewCDTProjectWizard_refPageDesc=Select referenced projects
NewCDTProjectWizard_refPageTitle=Project References
NewCDTProjectWizard_templatePageDesc=Select a project template for the new project
NewCDTProjectWizard_templatePageTitle=Project Template
NewCDTProjectWizard_windowTitle=New C/C++ Project

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.launch.remote;singleton:=true
Bundle-Version: 2.3.0.qualifier
Bundle-Version: 2.4.0.qualifier
Bundle-Activator: org.eclipse.cdt.internal.launch.remote.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2009, 2010 MontaVista Software, Inc. and others.
* Copyright (c) 2009, 2012 MontaVista Software, Inc. and others.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -8,6 +8,7 @@
* Anna Dushistova (MontaVista) - initial API and implementation
* Anna Dushistova (Mentor Graphics) - [314659] moved common methods for DSF and CDI launches to this class
* Anna Dushistova (Mentor Graphics) - changed spaceEscapify visibility
* Anna Dushistova (MontaVista) - [318051][remote debug] Terminating when "Remote shell" process is selected doesn't work
********************************************************************************/
package org.eclipse.cdt.launch.remote;
@ -283,6 +284,42 @@ public class RSEHelper {
return p;
}
public static IHostShell execCmdInRemoteShell(ILaunchConfiguration config,
String prelaunchCmd, String remoteCommandPath, String arguments,
IProgressMonitor monitor) throws Exception {
// The exit command is called to force the remote shell to close after
// our command
// is executed. This is to prevent a running process at the end of the
// debug session.
// See Bug 158786.
monitor.beginTask(NLS.bind(Messages.RemoteRunLaunchDelegate_8,
remoteCommandPath, arguments), 10);
String realRemoteCommand = arguments == null ? spaceEscapify(remoteCommandPath)
: spaceEscapify(remoteCommandPath) + " " + arguments; //$NON-NLS-1$
String remoteCommand = realRemoteCommand + CMD_DELIMITER + EXIT_CMD;
if (!prelaunchCmd.trim().equals("")) //$NON-NLS-1$
remoteCommand = prelaunchCmd + CMD_DELIMITER + remoteCommand;
IShellService shellService = null;
shellService = (IShellService) RSEHelper
.getConnectedRemoteShellService(getCurrentConnection(config),
new SubProgressMonitor(monitor, 7));
// This is necessary because runCommand does not actually run the
// command right now.
String env[] = new String[0];
IHostShell hostShell = null;
if (shellService != null) {
hostShell = shellService.launchShell(
"", env, new SubProgressMonitor(monitor, 3)); //$NON-NLS-1$
hostShell.writeToShell(remoteCommand);
}
monitor.done();
return hostShell;
}
public static String getRemoteHostname(ILaunchConfiguration config)
throws CoreException {
IHost currentConnection = getCurrentConnection(config);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2011 Mentor Graphics Corporation and others.
* Copyright (c) 2010, 2012 Mentor Graphics Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,12 +8,21 @@
* Contributors:
* Anna Dushistova (Mentor Graphics) - initial API and implementation
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.launching
* Anna Dushistova (MontaVista) - [318051][remote debug] Terminating when "Remote shell" process is selected doesn't work
*******************************************************************************/
package org.eclipse.cdt.launch.remote.launching;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.internal.launch.remote.Activator;
import org.eclipse.cdt.internal.launch.remote.Messages;
import org.eclipse.cdt.launch.remote.IRemoteConnectionConfigurationConstants;
@ -30,6 +39,8 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.services.shells.HostShellProcessAdapter;
import org.eclipse.rse.services.shells.IHostShell;
public class RemoteGdbLaunchDelegate extends GdbLaunchDelegate {
@ -77,14 +88,57 @@ public class RemoteGdbLaunchDelegate extends GdbLaunchDelegate {
if (arguments != null && !arguments.equals("")) //$NON-NLS-1$
commandArguments += " " + arguments; //$NON-NLS-1$
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_9);
remoteShellProcess = RSEHelper.remoteShellExec(config,
prelaunchCmd, gdbserverCommand, commandArguments,
// extending HostShellProcessAdapter here
final GdbLaunch l = (GdbLaunch)launch;
IHostShell remoteShell = null;
try {
remoteShell = RSEHelper.execCmdInRemoteShell(config, prelaunchCmd,
gdbserverCommand, commandArguments,
new SubProgressMonitor(monitor, 5));
} catch (Exception e1) {
RSEHelper.abort(e1.getMessage(), e1,
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
try {
remoteShellProcess = new HostShellProcessAdapter(remoteShell) {
@Override
public synchronized void destroy() {
final DsfSession session = l.getSession();
if (session != null) {
try {
session.getExecutor().execute(new DsfRunnable() {
public void run() {
DsfServicesTracker tracker = new DsfServicesTracker(
Activator.getBundleContext(),
session.getId());
IGDBControl control = tracker
.getService(IGDBControl.class);
if (control != null) {
control.terminate(new ImmediateRequestMonitor());
}
tracker.dispose();
}
});
} catch (RejectedExecutionException e) {
// Session disposed.
}
}
super.destroy();
}
};
} catch (Exception e) {
if (remoteShellProcess != null) {
remoteShellProcess.destroy();
}
RSEHelper.abort(Messages.RemoteRunLaunchDelegate_7, e,
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
DebugPlugin.newProcess(launch, remoteShellProcess,
Messages.RemoteRunLaunchDelegate_RemoteShell);
// 3. Let debugger know how gdbserver was started on the remote
ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2010 PalmSource, Inc. and others.
* Copyright (c) 2006, 2012 PalmSource, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -18,6 +18,7 @@
* Anna Dushistova (MontaVista) - [267951][remotecdt] Support systemTypes without files subsystem
* Anna Dushistova (Mentor Graphics) - [314659]Fixed deprecated methods
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.launching
* Anna Dushistova (MontaVista) - [318051][remote debug] Terminating when "Remote shell" process is selected doesn't work
*******************************************************************************/
package org.eclipse.cdt.launch.remote.launching;
@ -53,9 +54,13 @@ import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.services.shells.HostShellProcessAdapter;
import org.eclipse.rse.services.shells.IHostShell;
public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
private ICDISession dsession;
/*
* (non-Javadoc)
*
@ -103,7 +108,7 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
if (debugMode
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) {
Process remoteShellProcess = null;
ICDISession dsession = null;
dsession = null;
try {
// Download the binary to the remote before debugging.
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_2);
@ -127,10 +132,38 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
if (arguments != null && !arguments.equals("")) //$NON-NLS-1$
command_arguments += " " + arguments; //$NON-NLS-1$
monitor.setTaskName(Messages.RemoteRunLaunchDelegate_9);
remoteShellProcess = RSEHelper.remoteShellExec(config,
prelaunchCmd, gdbserver_command,
command_arguments, new SubProgressMonitor(
monitor, 5));
IHostShell remoteShell = null;
try {
remoteShell = RSEHelper.execCmdInRemoteShell(config, prelaunchCmd,
gdbserver_command, command_arguments,
new SubProgressMonitor(monitor, 5));
} catch (Exception e1) {
RSEHelper.abort(e1.getMessage(), e1,
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
try {
remoteShellProcess = new HostShellProcessAdapter(remoteShell) {
@Override
public synchronized void destroy() {
ICDISession session = getSession();
if (session != null) {
try {
session.terminate();
} catch (CDIException e) {
}
}
super.destroy();
}
};
} catch (Exception e) {
if (remoteShellProcess != null) {
remoteShellProcess.destroy();
}
RSEHelper.abort(Messages.RemoteRunLaunchDelegate_7, e,
ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
DebugPlugin.newProcess(launch, remoteShellProcess,
Messages.RemoteRunLaunchDelegate_RemoteShell);
@ -239,4 +272,8 @@ public class RemoteRunLaunchDelegate extends AbstractCLaunchDelegate {
protected String getPluginID() {
return Activator.PLUGIN_ID;
}
ICDISession getSession(){
return dsession;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2009 QNX Software Systems and others.
* Copyright (c) 2000, 2012 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,6 +9,7 @@
* QNX Software Systems - Initial API and implementation
* Ericsson AB - Modified for new DSF Reference Implementation
* Ericsson AB - Reverted to byte[] and processed multi-line results
* Harish Dewan (Tensilica Inc) - Bug 369377: Output for command should include value of 'nr-bytes' field
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@ -139,7 +140,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
}
// Parse 'nr-bytes="x"', the number of bytes read
if (var.equals("total-bytes")) { //$NON-NLS-1$
if (var.equals("nr-bytes")) { //$NON-NLS-1$
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
String size = ((MIConst) value).getCString();

View file

@ -124,6 +124,7 @@ public class MIThread {
private static Pattern fgOsIdPattern1 = Pattern.compile("([Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", 0); //$NON-NLS-1$
private static Pattern fgOsIdPattern2 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*\\d+\\.(\\d+)", 0); //$NON-NLS-1$
private static Pattern fgOsIdPattern3 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\S+)", 0); //$NON-NLS-1$
private static Pattern fgOsIdPattern4 = Pattern.compile("[Pp][Rr][Oo][Cc][Ee][Ss][Ss]\\s*(\\S+)", 0); //$NON-NLS-1$
static String parseOsId(String str) {
// General format:
@ -132,6 +133,8 @@ public class MIThread {
// "Thread 162.32942"
// ^^^^^
// "thread abc123"
//
// "process 12345" => Linux without pthread. The process as one thread, the process thread.
// ^^^^^^
// PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
@ -150,6 +153,11 @@ public class MIThread {
return matcher.group(1);
}
matcher = fgOsIdPattern4.matcher(str);
if (matcher.find()) {
return matcher.group(1);
}
return null;
}

View file

@ -12,6 +12,7 @@ public class MIThreadTests {
assertEquals("abc123", MIThread.parseOsId("Thread abc123"));
assertEquals("abc123", MIThread.parseOsId("thread abc123"));
assertEquals("abc123", MIThread.parseOsId("THREAD abc123"));
assertEquals("abc123", MIThread.parseOsId("process abc123"));
}
@Test

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2011 Ericsson and others.
* Copyright (c) 2009, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -17,6 +17,7 @@ import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0.Suite_7_0;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.Suite_7_1;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2.Suite_7_2;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.Suite_7_3;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4.Suite_7_4;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -31,6 +32,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
Suite_7_4.class,
Suite_7_3.class,
Suite_7_2.class,
Suite_7_1.class,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Ericsson and others.
* Copyright (c) 2009, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -17,6 +17,7 @@ import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0.Suite_Remote_7_0;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.Suite_Remote_7_1;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2.Suite_Remote_7_2;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.Suite_Remote_7_3;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4.Suite_Remote_7_4;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -31,6 +32,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
Suite_Remote_7_4.class,
Suite_Remote_7_3.class,
Suite_Remote_7_2.class,
Suite_Remote_7_1.class,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 Ericsson and others.
* Copyright (c) 2010, 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Ericsson AB - Initial implementation of Test cases
* Marc Khouzam (Ericsson) - Tests for GDB 7.4
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
@ -19,4 +20,5 @@ public interface ITestConstants {
public static final String SUFFIX_GDB_7_1 = "7.1";
public static final String SUFFIX_GDB_7_2 = "7.2";
public static final String SUFFIX_GDB_7_3 = "7.3";
public static final String SUFFIX_GDB_7_4 = "7.4";
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.GDBProcessesTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class GDBProcessesTest_7_4 extends GDBProcessesTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.GDBRemoteTracepointsTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class GDBRemoteTracepointsTest_7_4 extends GDBRemoteTracepointsTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,28 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.LaunchConfigurationAndRestartTest_7_3;
import org.junit.Before;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class LaunchConfigurationAndRestartTest_7_4 extends LaunchConfigurationAndRestartTest_7_3 {
// For the launch config test, we must set the attributes in the @Before method
// instead of the @BeforeClass method. This is because the attributes are overwritten
// by the tests themselves
@Before
public void beforeMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,64 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIBreakpointsTest_7_3;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIBreakpointsTest_7_4 extends MIBreakpointsTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
/*
* Starting with GDB 7.4, breakpoints at invalid lines succeed and become
* pending breakpoints. This is because the invalid line for one file,
* may be valid for another file with the same name.
* One could argue that line 0 is an exception, but GDB does not make
* a difference.
* @see org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest#insertBreakpoint_InvalidLineNumber()
*/
@Override
@Test
public void insertBreakpoint_InvalidLineNumber() throws Throwable {
// Create a line breakpoint
Map<String, Object> breakpoint = new HashMap<String, Object>();
breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG);
breakpoint.put(FILE_NAME_TAG, SOURCE_FILE);
breakpoint.put(LINE_NUMBER_TAG, 0);
// Perform the test
IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint);
assertTrue(fWait.getMessage(), fWait.isOK());
// Ensure that no BreakpointEvent was received
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received "
+ fBreakpointEventCount, fBreakpointEventCount == 1);
MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(ref);
assertTrue("Breakpoint should be pending", bpData.isPending());
assertTrue("Breakpoint mismatch should be enabled", bpData.isEnabled());
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MICatchpointsTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MICatchpointsTest_7_4 extends MICatchpointsTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIDisassemblyTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIDisassemblyTest_7_4 extends MIDisassemblyTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIExpressionsTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIExpressionsTest_7_4 extends MIExpressionsTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIMemoryTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIMemoryTest_7_4 extends MIMemoryTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIRegistersTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIRegistersTest_7_4 extends MIRegistersTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIRunControlNonStopTargetAvailableTest_7_4 extends MIRunControlTargetAvailableTest_7_4 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIRunControlTargetAvailableTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIRunControlTargetAvailableTest_7_4 extends MIRunControlTargetAvailableTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIRunControlTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIRunControlTest_7_4 extends MIRunControlTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class OperationsWhileTargetIsRunningNonStopTest_7_4 extends OperationsWhileTargetIsRunningTest_7_4 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, true);
}
}

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.OperationsWhileTargetIsRunningTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class OperationsWhileTargetIsRunningTest_7_4 extends OperationsWhileTargetIsRunningTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.PostMortemCoreTest_7_3;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class PostMortemCoreTest_7_4 extends PostMortemCoreTest_7_3 {
@BeforeClass
public static void beforeClassMethod_7_4() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4);
}
}

View file

@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
* This class is meant to be empty. It enables us to define
* the annotations which list all the different JUnit class we
* want to run. When creating a new test class, it should be
* added to the list below.
*
* This suite is for tests to be run with GDB 7.4
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
MIRegistersTest_7_4.class,
MIRunControlTest_7_4.class,
MIRunControlTargetAvailableTest_7_4.class,
MIRunControlNonStopTargetAvailableTest_7_4.class,
MIExpressionsTest_7_4.class,
MIMemoryTest_7_4.class,
MIBreakpointsTest_7_4.class,
MICatchpointsTest_7_4.class,
MIDisassemblyTest_7_4.class,
GDBProcessesTest_7_4.class,
LaunchConfigurationAndRestartTest_7_4.class,
OperationsWhileTargetIsRunningTest_7_4.class,
OperationsWhileTargetIsRunningNonStopTest_7_4.class,
PostMortemCoreTest_7_4.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})
public class Suite_7_4 {}

View file

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2012 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc Khouzam (Ericsson) - Initial implementation of Test cases
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
* This class is meant to be empty. It enables us to define
* the annotations which list all the different JUnit class we
* want to run. When creating a new test class, it should be
* added to the list below.
*
* This suite is for tests to be run with GDB 7.4
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
// We need specific name for the tests of this suite, because of bug https://bugs.eclipse.org/172256
GDBRemoteTracepointsTest_7_4.class,
MIRegistersTest_7_4.class,
MIRunControlTest_7_4.class,
MIRunControlTargetAvailableTest_7_4.class,
MIRunControlNonStopTargetAvailableTest_7_4.class,
MIExpressionsTest_7_4.class,
MIMemoryTest_7_4.class,
MIBreakpointsTest_7_4.class,
MICatchpointsTest_7_4.class,
MIDisassemblyTest_7_4.class,
GDBProcessesTest_7_4.class,
OperationsWhileTargetIsRunningTest_7_4.class,
OperationsWhileTargetIsRunningNonStopTest_7_4.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})
public class Suite_Remote_7_4 extends BaseRemoteSuite {
}