Skip to content

Commit e2ad8eb

Browse files
author
jan
committed
Split of the tests that fail on github
1 parent 6e7a835 commit e2ad8eb

File tree

2 files changed

+82
-41
lines changed

2 files changed

+82
-41
lines changed

io.sloeber.tests/src/io/sloeber/core/BuildTests.java

-41
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.eclipse.core.resources.ResourcesPlugin;
3232
import org.eclipse.core.runtime.CoreException;
3333
import org.eclipse.core.runtime.IPath;
34-
import org.eclipse.core.runtime.IProgressMonitor;
3534
import org.eclipse.core.runtime.NullProgressMonitor;
3635
import org.junit.jupiter.api.BeforeAll;
3736
import org.junit.jupiter.api.BeforeEach;
@@ -793,44 +792,4 @@ public void NightlyBoardPatron(String name, MCUBoard boardID, Example example, C
793792

794793
}
795794

796-
@Test
797-
public void onlyInstallLibraryWhenAllowed() throws Exception {
798-
String libName="SD";
799-
800-
//set option not to install lib
801-
ConfigurationPreferences.setInstallLibraries(false);
802-
803-
//uninstall lib
804-
LibraryManager.uninstallLibrary( libName);
805-
806-
// create a project that uses a the lib
807-
String testName = "onlyInstallLibraryWhenAllowed";
808-
IProgressMonitor monitor=new NullProgressMonitor();
809-
IPath templateFolder = Shared.getTemplateFolder(testName);
810-
CodeDescription codeDescriptor = CodeDescription.createCustomTemplate(templateFolder);
811-
MCUBoard unoboard = Arduino.uno();
812-
IProject theTestProject = SloeberProject.createArduinoProject(testName, null, unoboard.getBoardDescriptor(), codeDescriptor,
813-
new CompileDescription(), monitor);
814-
//wait for indexer and so on
815-
Shared.waitForAllJobsToFinish();
816-
817-
818-
//Building the project should fail
819-
assertNotNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber wrongly installed lib "+libName);
820-
821-
//set option to install libs
822-
ConfigurationPreferences.setInstallLibraries(true);
823-
824-
//trigger the indexer
825-
ICProject cTestProject = CoreModel.getDefault().getCModel().getCProject(theTestProject.getName());
826-
CCorePlugin.getIndexManager().reindex(cTestProject);
827-
Thread.sleep(5000);
828-
Shared.waitForIndexer(theTestProject);
829-
830-
//build should not fail
831-
assertNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber dit not install lib "+libName);
832-
833-
834-
835-
}
836795
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package io.sloeber.core;
2+
3+
4+
5+
6+
import org.eclipse.cdt.core.CCorePlugin;
7+
import org.eclipse.cdt.core.model.CoreModel;
8+
import org.eclipse.cdt.core.model.ICProject;
9+
import org.eclipse.core.resources.IProject;
10+
import org.eclipse.core.resources.IncrementalProjectBuilder;
11+
import org.eclipse.core.runtime.IPath;
12+
import org.eclipse.core.runtime.IProgressMonitor;
13+
import org.eclipse.core.runtime.NullProgressMonitor;
14+
import org.junit.jupiter.api.BeforeAll;
15+
import org.junit.jupiter.api.Test;
16+
import static org.junit.jupiter.api.Assertions.*;
17+
18+
import io.sloeber.arduinoFramework.api.LibraryManager;
19+
import io.sloeber.core.api.CodeDescription;
20+
import io.sloeber.core.api.CompileDescription;
21+
import io.sloeber.core.api.ConfigurationPreferences;
22+
import io.sloeber.core.api.SloeberProject;
23+
import io.sloeber.providers.Arduino;
24+
import io.sloeber.providers.MCUBoard;
25+
26+
@SuppressWarnings({ "nls", "static-method"})
27+
public class BuildTests_not_on_github {
28+
29+
/*
30+
* In new new installations (of the Sloeber development environment) the
31+
* installer job will trigger downloads These must have finished before we can
32+
* start testing
33+
*/
34+
@BeforeAll
35+
public static void beforeClass() throws Exception {
36+
Shared.waitForBoardsManager();
37+
Shared.setDeleteProjects(false);
38+
ConfigurationPreferences.setUseBonjour(false);
39+
}
40+
41+
42+
@Test
43+
public void onlyInstallLibraryWhenAllowed() throws Exception {
44+
String libName="SD";
45+
46+
//set option not to install lib
47+
ConfigurationPreferences.setInstallLibraries(false);
48+
49+
//uninstall lib
50+
LibraryManager.uninstallLibrary( libName);
51+
52+
// create a project that uses a the lib
53+
String testName = "onlyInstallLibraryWhenAllowed";
54+
IProgressMonitor monitor=new NullProgressMonitor();
55+
IPath templateFolder = Shared.getTemplateFolder(testName);
56+
CodeDescription codeDescriptor = CodeDescription.createCustomTemplate(templateFolder);
57+
MCUBoard unoboard = Arduino.uno();
58+
IProject theTestProject = SloeberProject.createArduinoProject(testName, null, unoboard.getBoardDescriptor(), codeDescriptor,
59+
new CompileDescription(), monitor);
60+
//wait for indexer and so on
61+
Shared.waitForAllJobsToFinish();
62+
63+
64+
//Building the project should fail
65+
assertNotNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber wrongly installed lib "+libName);
66+
67+
//set option to install libs
68+
ConfigurationPreferences.setInstallLibraries(true);
69+
70+
//trigger the indexer
71+
ICProject cTestProject = CoreModel.getDefault().getCModel().getCProject(theTestProject.getName());
72+
CCorePlugin.getIndexManager().reindex(cTestProject);
73+
Thread.sleep(5000);
74+
Shared.waitForIndexer(theTestProject);
75+
76+
//build should not fail
77+
assertNull( Shared.buildAndVerify(theTestProject,3,IncrementalProjectBuilder.FULL_BUILD ,monitor),"Sloeber dit not install lib "+libName);
78+
79+
80+
81+
}
82+
}

0 commit comments

Comments
 (0)