Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJeff Johnston2018-10-02 14:43:20 -0400
committerJeff Johnston2018-10-02 17:11:33 -0400
commit9b3ccf516fee412b48ff8b4fcfe76a22fdcb27cd (patch)
tree50c58c28075d2feb129e3743eabe4e955b66dab5 /build
parent0593f0b3afe8b07b034356a4cd72891783e9f4c6 (diff)
downloadorg.eclipse.cdt-9b3ccf516fee412b48ff8b4fcfe76a22fdcb27cd.tar.gz
org.eclipse.cdt-9b3ccf516fee412b48ff8b4fcfe76a22fdcb27cd.tar.xz
org.eclipse.cdt-9b3ccf516fee412b48ff8b4fcfe76a22fdcb27cd.zip
Bug 535903 - buildMesonProject test is unstable
- add wait for final String which may be delayed due to scanner info refresh Change-Id: Ib5c001b03cfb93335bf7b6dea2ef10a95e0bf856
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewManualNinjaTest.java35
-rw-r--r--build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonConfigureTest.java6
-rw-r--r--build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonProjectTest.java15
3 files changed, 48 insertions, 8 deletions
diff --git a/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewManualNinjaTest.java b/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewManualNinjaTest.java
index fc65258334..85611aec87 100644
--- a/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewManualNinjaTest.java
+++ b/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewManualNinjaTest.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IIndexManager;
import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.internal.meson.ui.tests.utils.CloseWelcomePageRule;
import org.eclipse.cdt.meson.core.MesonNature;
@@ -156,16 +157,30 @@ public class NewManualNinjaTest {
console.show();
console.setFocus();
- String[] lines = new String[0];
-
- while (lines.length < 15) {
- String output = console.bot().styledText().getText();
+ boolean foundExecutable = false;
+ while (!foundExecutable) {
+ IBinary[] binaries = cproject.getBinaryContainer().getBinaries();
+ if (binaries.length > 0) {
+ for (IBinary binary : binaries) {
+ if (binary.getResource().getName().startsWith(projectName)) {
+ foundExecutable = true;
+ }
+ }
+ }
+ bot.sleep(1000);
+ }
+ assertTrue(foundExecutable);
+
+ String output = console.bot().styledText().getText();
+
+ String[] lines = output.split("\\r?\\n"); //$NON-NLS-1$
+
+ while (lines.length < 9) {
+ output = console.bot().styledText().getText();
lines = output.split("\\r?\\n"); //$NON-NLS-1$
bot.sleep(2000);
}
-
- bot.sleep(3000);
-
+
assertEquals("Building in: " + projectPath + "/build/default", lines[0]);
assertEquals("The Meson build system", lines[2]);
assertTrue(lines[3].startsWith("Version:"));
@@ -174,6 +189,12 @@ public class NewManualNinjaTest {
assertEquals("Build type: native build", lines[6]);
assertEquals("Project name: MesonTestProj3", lines[7]);
assertTrue(lines[8].startsWith("Native C compiler: cc"));
+
+ int i = 0;
+ while (i < 10 && !lines[lines.length-1].startsWith("Build complete")) {
+ bot.sleep(1000);
+ ++i;
+ }
assertEquals("Build complete: " + projectPath + "/build/default", lines[lines.length-1]);
}
diff --git a/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonConfigureTest.java b/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonConfigureTest.java
index ff149053e9..37682e5b36 100644
--- a/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonConfigureTest.java
+++ b/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonConfigureTest.java
@@ -244,6 +244,12 @@ public class NewMesonConfigureTest {
assertTrue(lines[13+index].contains("-Werror"));
assertTrue(lines[14+index].startsWith("FAILED"));
assertTrue(lines[17+index].contains("Werror=unused-parameter"));
+
+ int i = 0;
+ while (i < 10 && !lines[lines.length-1].startsWith("Build complete")) {
+ bot.sleep(1000);
+ ++i;
+ }
assertEquals("Build complete: " + projectPath + "/build/default", lines[lines.length-1]);
}
diff --git a/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonProjectTest.java b/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonProjectTest.java
index bfec815320..4d3c759893 100644
--- a/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonProjectTest.java
+++ b/build/org.eclipse.cdt.meson.ui.tests/src/org/eclipse/cdt/internal/meson/ui/tests/NewMesonProjectTest.java
@@ -143,6 +143,7 @@ public class NewMesonProjectTest {
SWTBotTreeItem proj = explorer.bot().tree().getTreeItem(projectName).select();
proj.contextMenu("Build Project").click();
+ // wait until the binary shows up before testing the console output
boolean foundExecutable = false;
while (!foundExecutable) {
IBinary[] binaries = cproject.getBinaryContainer().getBinaries();
@@ -164,7 +165,13 @@ public class NewMesonProjectTest {
String output = console.bot().styledText().getText();
String[] lines = output.split("\\r?\\n"); //$NON-NLS-1$
-
+
+ while (lines.length < 15) {
+ output = console.bot().styledText().getText();
+ lines = output.split("\\r?\\n"); //$NON-NLS-1$
+ bot.sleep(2000);
+ }
+
assertEquals("Building in: " + projectPath + "/build/default", lines[0]);
assertEquals(" sh -c \"meson " + projectPath + "\"", lines[1]);
assertEquals("The Meson build system", lines[2]);
@@ -177,6 +184,12 @@ public class NewMesonProjectTest {
assertEquals("Build targets in project: 1", lines[11]);
assertTrue(lines[lines.length-3].startsWith("[1/2] cc -IMesonTestProj@exe"));
assertTrue(lines[lines.length-2].startsWith("[2/2] cc -o MesonTestProj"));
+
+ int i = 0;
+ while (i < 10 && !lines[lines.length-1].startsWith("Build complete")) {
+ bot.sleep(1000);
+ ++i;
+ }
assertEquals("Build complete: " + projectPath + "/build/default", lines[lines.length-1]);
}

Back to the top