add basic function-level testing for macro retrieval from a carbide project.
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java Fri Aug 13 10:30:38 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java Fri Aug 13 12:00:38 2010 -0500
@@ -44,6 +44,8 @@
import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter;
import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView;
import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter;
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory;
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
import com.nokia.carbide.cpp.project.core.ProjectCorePlugin;
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
import com.nokia.cpp.internal.api.utils.core.FileUtils;
@@ -193,4 +195,21 @@
}
}
+ public void testProjectMaroRetrieval() throws Exception {
+ ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(carbideProject);
+
+ List<IDefine> projectDefines = EpocEngineHelper.getGlobalDefinesForConfiguration(cpi.getDefaultConfiguration(), null);
+
+ boolean testSpecificMacro = false;
+ for (IDefine define: projectDefines){
+ if (define.getName().equals("__SUPPORT_CPP_EXCEPTIONS__")){
+ testSpecificMacro = true;
+ break;
+ }
+ }
+ assertTrue(testSpecificMacro);
+
+ assertTrue(cpi.getDefaultConfiguration().getCompileTimeMacros().size() > 0);
+ }
+
}
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Fri Aug 13 10:30:38 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestPlugin.java Fri Aug 13 12:00:38 2010 -0500
@@ -17,17 +17,21 @@
*/
package com.nokia.carbide.cdt.builder.test;
-import com.nokia.carbide.cpp.sdk.core.*;
-
-import org.eclipse.ui.plugin.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.osgi.framework.BundleContext;
-
+import java.io.File;
import java.util.Collections;
import java.util.List;
import junit.framework.TestCase;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+
public class TestPlugin extends AbstractUIPlugin {
//The shared instance.
@@ -79,9 +83,12 @@
*/
public static List<ISymbianBuildContext> getUsableBuildConfigs() {
for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()) {
- List<ISymbianBuildContext> contexts = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations();
- if (contexts.size() > 0) {
- return contexts.subList(0, Math.min(contexts.size(), 8));
+ if ((new File(sdk.getEPOCROOT()).exists())){
+ // TODO: Convert to SBSv2 test
+ List<ISymbianBuildContext> contexts = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getAllBuildConfigurations();
+ if (contexts.size() > 0) {
+ return contexts.subList(0, Math.min(contexts.size(), 8));
+ }
}
}
TestCase.fail("No installed SDKs provide build configurations");