1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Additional test for mulitple input and output

This commit is contained in:
Leo Treggiari 2005-05-20 02:35:16 +00:00
parent 2496e20554
commit bc48508cee
4 changed files with 83 additions and 2 deletions

View file

@ -1859,6 +1859,7 @@
<outputType
outputs=""
buildVariable="EXECUTABLES"
nameProvider="org.eclipse.cdt.managedbuilder.testplugin.TestLinkerNameProvider"
id="cdt.managedbuild.tool.testgnu30.c.linker.output">
</outputType>
</tool>
@ -3119,7 +3120,7 @@
<configuration
name="TheConfig"
id="test30_1.gnu.so.config"
artifactExtension="so.1.2.3"
artifactExtension="so.4.5.6"
cleanCommand="rm -rf"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser">
<toolChain
@ -3127,7 +3128,7 @@
osList="all"
name="ToolChain for test30_1"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"
targetTool="cdt.managedbuild.tool30.deploy.x.c"
targetTool="test30_1.gnu.so.deploy"
secondaryOutputs="test30_1.gnu.so.cjpeg.output"
id="test30_1.gnu.so.toolchain">
<targetPlatform
@ -3201,6 +3202,7 @@
name="Strip object file"
command="strip"
outputFlag="-o"
commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"
id="test30_1.gnu.so.strip">
<optionCategory
name="Misc"
@ -3213,6 +3215,7 @@
id="test30_1.gnu.so.strip.misc.other"
valueType="string">
</option>
<!-- The following buildVariable should be ignored because a pattern rule is generated -->
<inputType
id="test30_1.gnu.so.strip.input"
buildVariable="OBJS"
@ -3229,6 +3232,7 @@
name="Convert to jpeg"
command="cjpeg"
outputFlag="-outfile"
commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"
id="test30_1.gnu.so.cjpeg">
<optionCategory
name="Misc"

View file

@ -0,0 +1,63 @@
/**********************************************************************
* Copyright (c) 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Intel Corporation - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.managedbuilder.testplugin;
import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
public class TestLinkerNameProvider implements IManagedOutputNameProvider {
public IPath[] getOutputNames(ITool tool, IPath[] primaryInputNames) {
IPath[] name = new IPath[1];
boolean isSO = false;
IOption optShared = tool.getOptionBySuperClassId("gnu.c.link.option30.shared"); //$NON-NLS-1$
if (optShared != null) {
try {
isSO = optShared.getBooleanValue();
} catch (Exception e) {}
}
if (isSO) {
String soName = ""; //$NON-NLS-1$
IOption optSOName = tool.getOptionBySuperClassId("gnu.c.link.option30.soname"); //$NON-NLS-1$
if (optSOName != null) {
try {
soName = optSOName.getStringValue();
} catch (Exception e) {}
}
if (soName != null && soName.length() > 0) {
name[0] = Path.fromOSString(soName);
} else {
name[0] = Path.fromOSString(primaryInputNames[0].removeFileExtension().addFileExtension("so").lastSegment()); //$NON-NLS-1$
}
return name;
}
String fileName = "default"; //$NON-NLS-1$
if (primaryInputNames != null && primaryInputNames.length > 0) {
fileName = primaryInputNames[0].removeFileExtension().toString();
if (fileName.startsWith("$(") && fileName.endsWith(")")) { //$NON-NLS-1$ //$NON-NLS-2$
fileName = fileName.substring(2,fileName.length()-1);
}
}
String[] exts = tool.getPrimaryOutputType().getOutputExtensions();
if (exts != null && exts[0].length() > 0) {
fileName += IManagedBuilderMakefileGenerator.DOT + exts[0];
}
name[0] = Path.fromOSString(fileName);
name[0] = name[0].removeFirstSegments(name[0].segmentCount() - 1);
return name;
}
}

View file

@ -56,6 +56,7 @@ public class ManagedProject30MakefileTests extends TestCase {
// rather than an MBS functionality issue
//suite.addTest(new ManagedProject30MakefileTests("test30LinkedFolder"));
suite.addTest(new ManagedProject30MakefileTests("test30CopyandDeploy"));
suite.addTest(new ManagedProject30MakefileTests("test30_1"));
return suite;
}
@ -321,4 +322,17 @@ public class ManagedProject30MakefileTests extends TestCase {
IProject[] projects = createProjects("copyandDeploy", null, null, true);
buildProjects(projects, makefiles);
}
/* (non-Javadoc)
* tests 3.0 style tool integration with pre and post process steps added to typical compile & link
*/
public void test30_1(){
IPath[] makefiles = {
Path.fromOSString("makefile"),
Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk")};
IProject[] projects = createProjects("test30_1", null, null, true);
buildProjects(projects, makefiles);
}
}