1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 22:05:44 +02:00

Enable Autotools UI tests which use SWTBot.

Change-Id: I4269954635a3d7a534092daf8a85c4c8be6cc63b
Reviewed-on: https://git.eclipse.org/r/33143
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
Tested-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
Jeff Johnston 2014-09-09 15:26:12 -04:00
parent cee1a39898
commit 2706336f46
4 changed files with 51 additions and 30 deletions

View file

@ -37,6 +37,7 @@
<includes>
<include>**/AllTests.*</include>
</includes>
<testFailureIgnore>true</testFailureIgnore>
<dependencies>
<dependency>
<artifactId>org.eclipse.platform.feature.group</artifactId>
@ -47,4 +48,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 Red Hat Inc..
* Copyright (c) 2010, 2014 Red Hat Inc..
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,9 +7,15 @@
*
* Contributors:
* Red Hat Incorporated - initial API and implementation
* Marc Khouzam (Ericsson) - Skip tests if autotools binaries are not available
*******************************************************************************/
package org.eclipse.cdt.autotools.ui.tests;
import java.io.IOException;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -20,6 +26,22 @@ import org.junit.runners.Suite;
TestEnvironmentVars.class,
TestMakeTargets.class
})
public class AllTests {
// needed for this class to compile
// needed for this class to compile
@BeforeClass
public static void beforeClassMethod() {
// Verify that the necessary binaries are available, and if it is not,
// the tests will be ignored.
String[] testBinaryCommands = { "libtool --version", "autoconf --version" };
try {
for (String cmd : testBinaryCommands) {
Process process = ProcessFactory.getFactory().exec(cmd);
process.destroy();
}
} catch (IOException e) {
// If we cannot find any binary, just ignore the tests.
Assume.assumeNoException(e);
}
}
}

View file

@ -75,7 +75,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking aclocal in.*" + projectName
+ ".*aclocal --help.*Usage: aclocal.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
// Verify we still don't have an aclocal.m4 file yet
f = new File(path.toOSString());
assertTrue(!f.exists());
@ -92,7 +92,7 @@ public class TestToolActions extends AbstractTest {
p = Pattern.compile(".*Invoking aclocal in.*" + projectName
+ ".*aclocal.*", Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
// We need to wait until the aclocal.m4 file is created so
// sleep a bit and look for it...give up after 20 seconds
for (int i = 0; i < 40; ++i) {
@ -125,7 +125,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking autoconf in.*" + projectName
+ ".*autoconf.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
// We need to wait until the configure file is created so
// sleep a bit and look for it...give up after 20 seconds
for (int i = 0; i < 40; ++i) {
@ -152,7 +152,7 @@ public class TestToolActions extends AbstractTest {
p = Pattern.compile(".*Invoking autoconf in.*" + projectName
+ ".*autoconf.*", Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
// We need to wait until the configure file is created so
// sleep a bit and look for it...give up after 20 seconds
for (int i = 0; i < 40; ++i) {
@ -197,7 +197,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking automake in.*" + projectName
+ ".*automake --help.*Usage:.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
// Verify we still don't have Makefile.in files yet
f = new File(path.toOSString());
assertTrue(!f.exists());
@ -221,7 +221,7 @@ public class TestToolActions extends AbstractTest {
+ ".*automake --add-missing Makefile src/Makefile.*",
Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
// We need to wait until the Makefile.in files are created so
// sleep a bit and look for it...give up after 20 seconds
for (int i = 0; i < 40; ++i) {
@ -256,7 +256,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking libtoolize in.*" + projectName
+ ".*libtoolize --help.*Usage: libtoolize.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
}
// Verify we can access the libtoolize tool
@ -275,7 +275,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking autoheader in.*" + projectName
+ ".*autoheader --help.*Usage:.*autoheader.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
}
// Verify we can access the autoreconf tool
@ -316,7 +316,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking autoreconf in.*" + projectName
+ ".*autoreconf --help.*Usage: .*autoreconf.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
clickProjectContextMenu("Invoke Autotools", "Invoke Autoreconf");
shell = bot.shell("Autoreconf Options");
shell.activate();
@ -325,19 +325,17 @@ public class TestToolActions extends AbstractTest {
// We need to wait until the Makefile.in file is created so
// sleep a bit and look for it
bot.sleep(3000);
// Verify a number of generated files now exist
f = new File(path.append("Makefile.in").toOSString());
assertTrue(f.exists());
f = new File(path.append("src/Makefile.in").toOSString());
assertTrue(f.exists());
f = new File(path.append("Makefile.in").toOSString());
assertTrue(f.exists());
f = new File(path.append("configure").toOSString());
assertTrue(f.exists());
f = new File(path.append("config.status").toOSString());
assertTrue(!f.exists()); // shouldn't have run configure
f = new File(path.append("config.sub").toOSString());
assertTrue(f.exists());
String[] fileList = { "Makefile.in", "src/Makefile.in", "configure", "config.sub" };
for (String name : fileList) {
f = new File(path.append(name).toOSString());
assertTrue("Missing: " + name, f.exists());
}
String name = "config.status";
f = new File(path.append(name).toOSString());
assertTrue("Mistakenly found: " + name, !f.exists()); // shouldn't have run configure
}
@Test
@ -467,7 +465,7 @@ public class TestToolActions extends AbstractTest {
Pattern p = Pattern.compile(".*Invoking aclocal in.*" + projectName
+ ".*automake --help.*Usage:.*automake.*", Pattern.DOTALL);
Matcher m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
clickProjectContextMenu("Invoke Autotools", "Invoke Automake");
shell = bot.shell("Automake Options");
@ -482,7 +480,7 @@ public class TestToolActions extends AbstractTest {
p = Pattern.compile(".*Invoking automake in.*" + projectName
+ ".*autoconf --help.*Usage:.*autoconf.*", Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
clickProjectContextMenu("Invoke Autotools", "Invoke Autoheader");
shell = bot.shell("Autoheader Options");
@ -497,7 +495,7 @@ public class TestToolActions extends AbstractTest {
p = Pattern.compile(".*Invoking autoheader in.*" + projectName
+ ".*autoreconf --help.*Usage:.*autoreconf.*", Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
clickProjectContextMenu("Invoke Autotools", "Invoke Autoreconf");
shell = bot.shell("Autoreconf Options");
@ -512,7 +510,7 @@ public class TestToolActions extends AbstractTest {
p = Pattern.compile(".*Invoking autoreconf in.*" + projectName
+ ".*libtoolize --help.*Usage:.*libtoolize.*", Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
clickProjectContextMenu("Invoke Autotools", "Invoke Libtoolize");
shell = bot.shell("Libtoolize Options");
@ -527,7 +525,7 @@ public class TestToolActions extends AbstractTest {
p = Pattern.compile(".*Invoking libtoolize in.*" + projectName
+ ".*aclocal --help.*Usage:.*aclocal.*", Pattern.DOTALL);
m = p.matcher(output);
assertTrue(m.matches());
assertTrue("Got: " + output, m.matches());
}
}

View file

@ -183,7 +183,7 @@
<module>build/org.eclipse.cdt.autotools.docs</module>
<module>build/org.eclipse.cdt.autotools.tests</module>
<module>build/org.eclipse.cdt.autotools.ui</module>
<!--<module>build/org.eclipse.cdt.autotools.ui.tests</module>-->
<module>build/org.eclipse.cdt.autotools.ui.tests</module>
<module>build/org.eclipse.cdt.autotools-feature</module>
<module>build/org.eclipse.cdt.autotools.source-feature</module>
<module>build/org.eclipse.linuxtools.cdt.autotools.core</module>