mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 535903 - buildMesonProject test is unstable
- add wait for final String which may be delayed due to scanner info refresh Change-Id: Ib5c001b03cfb93335bf7b6dea2ef10a95e0bf856
This commit is contained in:
parent
0593f0b3af
commit
9b3ccf516f
3 changed files with 48 additions and 8 deletions
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue