use of io.sloeber.core.api.BoardDescriptor in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileLibraryExamplesTest method testExamples.
@Test
public void testExamples() {
if (myTotalFails > maxFails) {
// failing is annoying when doing fixing
return;
}
if (skipAtStart >= myCounter++) {
// skip these
return;
}
if (!myBoardID.isExampleSupported(myExample)) {
fail("Trying to run a test on unsoprted board");
return;
}
ArrayList<IPath> paths = new ArrayList<>();
paths.add(myExample.getPath());
CodeDescriptor codeDescriptor = CodeDescriptor.createExample(false, paths);
Map<String, String> boardOptions = myBoardID.getBoardOptions(myExample);
BoardDescriptor boardDescriptor = myBoardID.getBoardDescriptor();
boardDescriptor.setOptions(boardOptions);
BuildAndVerify(myBoardID.getBoardDescriptor(), codeDescriptor);
}
use of io.sloeber.core.api.BoardDescriptor in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileTest method boards.
@SuppressWarnings("rawtypes")
@Parameters(name = "{index}: {0} ")
public static Collection boards() {
// build the Arduino way
Preferences.setUseArduinoToolSelection(true);
installAdditionalBoards();
List<BoardDescriptor> boards = new ArrayList<>();
for (String curBoardFile : PackageManager.getAllBoardsFiles()) {
// TOFIX these options should not be set here but in IBoard.getOptions
Map<String, String> options = null;
if (curBoardFile.contains("Jantje")) {
// for jantjes boards as unit testing does not make a exe without the gdb lib
options = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
options.put("type", "debug");
} else if (curBoardFile.contains("avr_boot")) {
// for avr_boot avr_boot_atmega328 to have variant
options = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
options.put("pinout", "avrdevelopers");
} else if (curBoardFile.contains("/tiny/hardware")) {
// do not use ATtiny85 @ 128 KHz (watchdog oscillator; 1.8 V BOD)
// fails in arduino IDE as well
options = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
options.put("cpu", "attiny25at1");
}
boards.addAll(BoardDescriptor.makeBoardDescriptors(new File(curBoardFile), options));
}
// to avoid warnings set the upload port to some value
for (BoardDescriptor curBoard : boards) {
curBoard.setUploadPort("none");
}
;
HashSet<String> boardsToIgnoreList = new HashSet<>(Arrays.asList(boardsToIgnoreOnAllOses));
if (SystemUtils.IS_OS_LINUX) {
boardsToIgnoreList.addAll(Arrays.asList(boardsToIgnoreOnLinux));
}
if (SystemUtils.IS_OS_WINDOWS) {
boardsToIgnoreList.addAll(Arrays.asList(boardsToIgnoreOnWindows));
}
List<BoardDescriptor> ignoreBoards = new ArrayList<>();
for (BoardDescriptor curBoard : boards) {
if (boardsToIgnoreList.contains(curBoard.getBoardName())) {
ignoreBoards.add(curBoard);
}
}
boards.removeAll(ignoreBoards);
return boards;
}
use of io.sloeber.core.api.BoardDescriptor in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method are_jantjes_options_taken_into_account.
/**
* This test will fail if the arduino compile option are not taken into
* account To do sa a bunch of defines are added to the command line and the
* code checks whether these defines are set properly
* @throws Exception
*/
@SuppressWarnings("static-method")
@Test
public void are_jantjes_options_taken_into_account() throws Exception {
PackageManager.installLatestPlatform("package_index.json", "arduino", "Arduino AVR Boards");
Map<String, String> unoOptions = new HashMap<>();
BoardDescriptor unoBoardid = PackageManager.getBoardDescriptor("package_index.json", "arduino", "Arduino AVR Boards", "uno", unoOptions);
IProject theTestProject = null;
String projectName = "are_defines_found";
IPath templateFolder = Shared.getTemplateFolder(projectName);
CodeDescriptor codeDescriptor = CodeDescriptor.createCustomTemplate(templateFolder);
NullProgressMonitor monitor = new NullProgressMonitor();
try {
CompileOptions compileOptions = new CompileOptions(null);
compileOptions.set_C_andCPP_CompileOptions("-DTEST_C_CPP");
compileOptions.set_C_CompileOptions("-DTEST_C");
compileOptions.set_CPP_CompileOptions("-DTEST_CPP");
theTestProject = unoBoardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, compileOptions, monitor);
ICProjectDescription prjCDesc = CoreModel.getDefault().getProjectDescription(theTestProject);
CoreModel.getDefault().getProjectDescriptionManager().setProjectDescription(theTestProject, prjCDesc, true, null);
// for the indexer
Shared.waitForAllJobsToFinish();
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project:" + projectName + " The defines have not been taken into account properly");
}
} catch (Exception e) {
e.printStackTrace();
fail("Failed to create the project:" + projectName);
return;
}
}
use of io.sloeber.core.api.BoardDescriptor in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method are_defines_before_includes_taken_into_account.
/**
* If a .ino file is including a include using extern C is this handled
* properly by the ino to cpp parser
* @throws Exception
*/
@SuppressWarnings("static-method")
@Test
public void are_defines_before_includes_taken_into_account() throws Exception {
PackageManager.installLatestPlatform("package_index.json", "arduino", "Arduino AVR Boards");
Map<String, String> unoOptions = new HashMap<>();
BoardDescriptor unoBoardid = PackageManager.getBoardDescriptor("package_index.json", "arduino", "Arduino AVR Boards", "uno", unoOptions);
IProject theTestProject = null;
String projectName = "externc";
IPath templateFolder = Shared.getTemplateFolder(projectName);
CodeDescriptor codeDescriptor = CodeDescriptor.createCustomTemplate(templateFolder);
NullProgressMonitor monitor = new NullProgressMonitor();
try {
theTestProject = unoBoardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null), monitor);
// for the indexer
Shared.waitForAllJobsToFinish();
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project:" + projectName + " extern \"C\" has not been taken into account properly.");
}
} catch (Exception e) {
e.printStackTrace();
fail("Failed to create the project:" + projectName);
return;
}
}
use of io.sloeber.core.api.BoardDescriptor in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method redirectedJson.
/**
* Test wether a platform json redirect is handled properly
* https://github.com/jantje/arduino-eclipse-plugin/issues/393
*/
@SuppressWarnings("static-method")
@Test
public void redirectedJson() {
// this board references to arduino avr so install that one to
PackageManager.installLatestPlatform("package_index.json", "arduino", "Arduino AVR Boards");
PackageManager.installLatestPlatform("package_talk2.wisen.com_index.json", "Talk2", "Talk2 AVR Boards");
Map<String, String> options = new HashMap<>();
options.put("mhz", "16MHz");
BoardDescriptor boardid = PackageManager.getBoardDescriptor("package_talk2.wisen.com_index.json", "Talk2", "Talk2 AVR Boards", "whispernode", options);
if (boardid == null) {
fail("redirect Json ");
return;
}
Shared.BuildAndVerify(boardid, CodeDescriptor.createDefaultIno());
}
Aggregations