use of org.eclipse.tycho.launching.LaunchConfiguration in project tycho by eclipse.
the class StandaloneDirectorRuntime method newInstallCommand.
@Override
public Command newInstallCommand() {
return new AbstractDirectorApplicationCommand() {
@Override
public void execute() throws DirectorCommandException {
List<String> programArguments = new ArrayList<>();
programArguments.add("-application");
programArguments.add("org.eclipse.equinox.p2.director");
programArguments.addAll(getDirectorApplicationArguments());
LaunchConfiguration launch = new EquinoxInstallationLaunchConfiguration(runtimeLocation, programArguments);
logger.info("Using the standalone p2 Director to install the product...");
int exitCode = launchHelper.execute(launch, forkedProcessTimeoutInSeconds);
if (exitCode != 0) {
throw new DirectorCommandException("Call to p2 director application failed with exit code " + exitCode + ". Program arguments were: " + programArguments + ".");
}
}
};
}
use of org.eclipse.tycho.launching.LaunchConfiguration in project tycho by eclipse.
the class TestMojo method runTest.
private void runTest(EquinoxInstallation testRuntime) throws MojoExecutionException, MojoFailureException {
int result;
try {
if (deleteOsgiDataDirectory) {
FileUtils.deleteDirectory(osgiDataDirectory);
}
LaunchConfiguration cli = createCommandLine(testRuntime);
getLog().info("Expected eclipse log file: " + new File(osgiDataDirectory, ".metadata/.log").getAbsolutePath());
result = launcher.execute(cli, forkedProcessTimeoutInSeconds);
} catch (Exception e) {
throw new MojoExecutionException("Error while executing platform", e);
}
switch(result) {
case 0:
getLog().info("All tests passed!");
break;
case 200:
/* see AbstractUITestApplication */
if (application == null) {
// the extra test dependencies should prevent this case
throw new MojoExecutionException("Could not find the default application \"org.eclipse.ui.ide.workbench\" in the test runtime.");
} else {
throw new MojoFailureException("Could not find application \"" + application + "\" in the test runtime. Make sure that the test runtime includes the bundle " + "which defines this application.");
}
case 254:
/* RunResult.NO_TESTS */
String message = "No tests found.";
if (failIfNoTests) {
throw new MojoFailureException(message);
} else {
getLog().warn(message);
}
break;
case 255:
/* RunResult.FAILURE */
String errorMessage = "There are test failures.\n\nPlease refer to " + reportsDirectory + " for the individual test results.";
if (testFailureIgnore) {
getLog().error(errorMessage);
} else {
throw new MojoFailureException(errorMessage);
}
break;
default:
throw new MojoFailureException("An unexpected error occured while launching the test runtime (return code " + result + "). See log for details.");
}
}
Aggregations