Skip to content

Commit

Permalink
Boardsmanager needs some time to get started
Browse files Browse the repository at this point in the history
For sure if everything needs to be downloaded (like in github build)
  • Loading branch information
jan committed Jun 22, 2024
1 parent bce21a2 commit 5f3f571
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
12 changes: 7 additions & 5 deletions io.sloeber.tests/src/io/sloeber/core/RegressionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,24 @@ public class RegressionTest {
* start testing
*/
@BeforeClass
public static void beforeClass() {
Shared.waitForAllJobsToFinish();
public static void beforeClass() throws Exception {
Shared.waitForBoardsManager();
Shared.setDeleteProjects(false);
Preferences.setUseBonjour(false);
installAdditionalBoards();
}

public static void installAdditionalBoards() {
public static void installAdditionalBoards() throws Exception {

String[] packageUrlsToAdd = { ESP8266.packageURL, ESP32.packageURL,
"http://talk2arduino.wisen.com.au/master/package_talk2.wisen.com_index.json" };
BoardsManager.addPackageURLs(new HashSet<>(Arrays.asList(packageUrlsToAdd)), false);
Shared.waitForBoardsManager();
if (reinstall_boards_and_libraries) {
BoardsManager.removeAllInstalledPlatforms();
}
// make sure the needed boards are available

ESP8266.installLatest();
ESP32.installLatest();
Arduino.installLatestAVRBoards();
Expand Down Expand Up @@ -572,7 +574,7 @@ public void uploadPattern() throws Exception {

}

public static Stream<Arguments> testDifferentSourceFoldersData() {
public static Stream<Arguments> testDifferentSourceFoldersData() throws Exception {
beforeClass();// This is not always called
List<Arguments> ret = new LinkedList<>();
OtherDescription otherDesc = new OtherDescription();
Expand Down Expand Up @@ -650,7 +652,7 @@ public void redirectedJson() throws Exception {
new CompileDescription()));
}

static Stream<Arguments> openAndClosePreservesSettingsValueCmd() {
static Stream<Arguments> openAndClosePreservesSettingsValueCmd() throws Exception {
beforeClass();// This is not always called
CodeDescription codeDescriptordefaultCPPRoot = new CodeDescription(CodeDescription.CodeTypes.defaultCPP);
CodeDescription codeDescriptordefaultCPPSrc = new CodeDescription(CodeDescription.CodeTypes.defaultCPP);
Expand Down
15 changes: 15 additions & 0 deletions io.sloeber.tests/src/io/sloeber/core/Shared.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import io.sloeber.autoBuild.api.AutoBuildProject;
import io.sloeber.autoBuild.api.IAutoBuildConfigurationDescription;
import io.sloeber.core.api.BoardDescription;
import io.sloeber.core.api.BoardsManager;
import io.sloeber.core.api.CodeDescription;
import io.sloeber.core.api.CompileDescription;
import io.sloeber.core.api.ConfigurationPreferences;
Expand Down Expand Up @@ -90,6 +91,20 @@ public static String hasBuildErrors(IProject project) throws CoreException {
return projectName + ": build is marked failed as the project does not contain any of "+validOutputss.toString();
}


public static void waitForBoardsManager() throws Exception {
int count=0;
while (!(BoardsManager.isReady())) {
count++;
Thread.sleep(500);
// If you do not get out of this loop it probably means you are
// runnning the test in the gui thread
if(count%10==0) {
System.out.println("Waiting for waitForBoardsManager");
}
}
}

public static void waitForAllJobsToFinish() {
// try {
// Thread.sleep(1000);
Expand Down

0 comments on commit 5f3f571

Please sign in to comment.