blob: 5854f0ae7e7a982c9ce7891b550dcff1e523ed78 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2012,2012 Andrew Gvozdev and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Andrew Gvozdev - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.tests.suite;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import junit.framework.TestCase;
public class Preconditions extends TestCase {
@Override
protected void setUp() throws Exception {
}
/**
* Many MBS tests run make and gcc and will inspect resulting artifacts of the build.
* Make sure GNU tool-chain is available for the tests.
*/
public void testGnu() {
IPath make = PathUtil.findProgramLocation("make");
assertNotNull("Precodition FAILED - program 'make' is not found in path.", make);
IPath gcc = PathUtil.findProgramLocation("gcc");
assertNotNull("Precodition FAILED - program 'gcc' is not found in path.", gcc);
}
/**
* Generated makefiles will often contain dependency lines for all file extension
* corresponding content types set in preferences. Make sure that this set has not been
* changed when the tests are run.
*/
public void testContentTypes() {
Set<String> fileExts = new TreeSet<String>();
IContentTypeManager manager = Platform.getContentTypeManager();
IContentType contentTypeCpp = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
fileExts.addAll(Arrays.asList(contentTypeCpp.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
IContentType contentTypeC = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
fileExts.addAll(Arrays.asList(contentTypeC.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
Set<String> expectedExts = new TreeSet<String>(
Arrays.asList(new String[] { "C", "c", "c++", "cc", "cpp", "cxx" }));
assertEquals("Precodition FAILED - Content Types do not match expected defaults.", expectedExts.toString(),
fileExts.toString());
}
}
|