Skip to content

Commit

Permalink
Split of the tests that fail on github
Browse files Browse the repository at this point in the history
  • Loading branch information
jan committed Nov 25, 2024
1 parent 6e7a835 commit e2ad8eb
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 41 deletions.
41 changes: 0 additions & 41 deletions io.sloeber.tests/src/io/sloeber/core/BuildTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -793,44 +792,4 @@ public void NightlyBoardPatron(String name, MCUBoard boardID, Example example, C

}

@Test
public void onlyInstallLibraryWhenAllowed() throws Exception {
String libName="SD";

//set option not to install lib
ConfigurationPreferences.setInstallLibraries(false);

//uninstall lib
LibraryManager.uninstallLibrary( libName);

// create a project that uses a the lib
String testName = "onlyInstallLibraryWhenAllowed";
IProgressMonitor monitor=new NullProgressMonitor();
IPath templateFolder = Shared.getTemplateFolder(testName);
CodeDescription codeDescriptor = CodeDescription.createCustomTemplate(templateFolder);
MCUBoard unoboard = Arduino.uno();
IProject theTestProject = SloeberProject.createArduinoProject(testName, null, unoboard.getBoardDescriptor(), codeDescriptor,
new CompileDescription(), monitor);
//wait for indexer and so on
Shared.waitForAllJobsToFinish();


//Building the project should fail
assertNotNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber wrongly installed lib "+libName);

//set option to install libs
ConfigurationPreferences.setInstallLibraries(true);

//trigger the indexer
ICProject cTestProject = CoreModel.getDefault().getCModel().getCProject(theTestProject.getName());
CCorePlugin.getIndexManager().reindex(cTestProject);
Thread.sleep(5000);
Shared.waitForIndexer(theTestProject);

//build should not fail
assertNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber dit not install lib "+libName);



}
}
82 changes: 82 additions & 0 deletions io.sloeber.tests/src/io/sloeber/core/BuildTests_not_on_github.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package io.sloeber.core;




import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

import io.sloeber.arduinoFramework.api.LibraryManager;
import io.sloeber.core.api.CodeDescription;
import io.sloeber.core.api.CompileDescription;
import io.sloeber.core.api.ConfigurationPreferences;
import io.sloeber.core.api.SloeberProject;
import io.sloeber.providers.Arduino;
import io.sloeber.providers.MCUBoard;

@SuppressWarnings({ "nls", "static-method"})
public class BuildTests_not_on_github {

/*
* In new new installations (of the Sloeber development environment) the
* installer job will trigger downloads These must have finished before we can
* start testing
*/
@BeforeAll
public static void beforeClass() throws Exception {
Shared.waitForBoardsManager();
Shared.setDeleteProjects(false);
ConfigurationPreferences.setUseBonjour(false);
}


@Test
public void onlyInstallLibraryWhenAllowed() throws Exception {
String libName="SD";

//set option not to install lib
ConfigurationPreferences.setInstallLibraries(false);

//uninstall lib
LibraryManager.uninstallLibrary( libName);

// create a project that uses a the lib
String testName = "onlyInstallLibraryWhenAllowed";
IProgressMonitor monitor=new NullProgressMonitor();
IPath templateFolder = Shared.getTemplateFolder(testName);
CodeDescription codeDescriptor = CodeDescription.createCustomTemplate(templateFolder);
MCUBoard unoboard = Arduino.uno();
IProject theTestProject = SloeberProject.createArduinoProject(testName, null, unoboard.getBoardDescriptor(), codeDescriptor,
new CompileDescription(), monitor);
//wait for indexer and so on
Shared.waitForAllJobsToFinish();


//Building the project should fail
assertNotNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber wrongly installed lib "+libName);

//set option to install libs
ConfigurationPreferences.setInstallLibraries(true);

//trigger the indexer
ICProject cTestProject = CoreModel.getDefault().getCModel().getCProject(theTestProject.getName());
CCorePlugin.getIndexManager().reindex(cTestProject);
Thread.sleep(5000);
Shared.waitForIndexer(theTestProject);

//build should not fail
assertNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber dit not install lib "+libName);



}
}

0 comments on commit e2ad8eb

Please sign in to comment.