Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/mavenBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ jobs:
if-no-files-found: warn
path: |
${{ github.workspace }}/**/target/surefire-reports/*.xml
${{ github.workspace }}/**/results/**/*.png
${{ github.workspace }}/**/target/screenshots/*.png
9 changes: 9 additions & 0 deletions eclipse-platform-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<!-- system specific JVM args; if needed provided by system properties to the build command -->
<surefire.systemProperties></surefire.systemProperties>
<surefire.timeout>1200</surefire.timeout>
<surefire.screenshot_directory>${project.build.directory}/screenshots</surefire.screenshot_directory>
<java.version>17</java.version>
<printApiMessages>false</printApiMessages>
<failOnJavadocErrors>false</failOnJavadocErrors>
Expand Down Expand Up @@ -343,6 +344,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<systemPropertyVariables>
<eclipse.test.screenshot_directory>${surefire.screenshot_directory}</eclipse.test.screenshot_directory>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -434,6 +440,9 @@
<enableAssertions>true</enableAssertions>
<argLine>${surefire.testArgLine} ${surefire.platformSystemProperties} ${surefire.systemProperties} ${surefire.moduleProperties}</argLine>
<quiet>true</quiet>
<systemProperties>
<eclipse.test.screenshot_directory>${surefire.screenshot_directory}</eclipse.test.screenshot_directory>
</systemProperties>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,34 @@ public static String takeScreenshot(Class<?> testClass, String name) {
return filename;
}

/**
* @return unspecified
* @noreference This method is not intended to be referenced by clients.
*/
public static File getResultsDirectory() {
File resultsDir = getJunitReportOutput(); // ends up in testresults/linux.gtk.x86_6.0/<class>.<test>.png
/**
* @return unspecified
* @noreference This method is not intended to be referenced by clients.
*/
public static File getResultsDirectory() {
File resultsDir = discoverResultsDirectory();
resultsDir.mkdirs();
return resultsDir;
}

if (resultsDir == null) {
File eclipseDir = new File("").getAbsoluteFile();
if (isRunByGerritHudsonJob()) {
resultsDir = new File(eclipseDir, "/../").getAbsoluteFile(); // ends up in the workspace root
} else {
resultsDir = new File(System.getProperty("java.io.tmpdir"));
}
}
private static File discoverResultsDirectory() {
File resultsDir = getJunitReportOutput(); // ends up in testresults/linux.gtk.x86_6.0/<class>.<test>.png
if (resultsDir != null) {
return resultsDir;
}
// Set from "surefire.screenshot_directory" Maven property by
// eclipse-platform-parent/pom.xml
String propertyPath = System.getProperty("eclipse.test.screenshot_directory");
if (propertyPath != null) {
return new File(propertyPath);
}

resultsDir.mkdirs();
return resultsDir;
}
return new File(System.getProperty("java.io.tmpdir"));
}

private static File getJunitReportOutput() {
private static File getJunitReportOutput() {
// Current implementation only interfaces with Ant test launcher.
// Maven tests do not use "-junitReportOutput" argument.
boolean platformAvailable = false;
try {
Class.forName("org.eclipse.core.runtime.Platform", false, Screenshots.class.getClassLoader());
Expand All @@ -140,14 +147,6 @@ private static File getJunitReportOutput() {
}
}
return null;
}

/**
* @return unspecified
* @noreference This method is not intended to be referenced by clients.
*/
public static boolean isRunByGerritHudsonJob() {
return System.getProperty("user.dir").matches(".*/(?:eclipse|rt\\.equinox)\\.[^/]+-Gerrit/.*");
}
}

}
Loading