Skip to content

Test failure screenshots are not archived in GitHub Actions #3303

@basilevs

Description

@basilevs

Screenshots are saved in /tmp folder and do not reach artifacts.

A test harness from platform aggregator relies on tycho-surefire to start Platform and discover a suitable storage location, but SWT is using Maven Surefire, so a tmp fallback is used instead.

https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/c82c02b58c46d0082ad127440d8155e2a9d7f632/eclipse.platform.releng/bundles/org.eclipse.test/src/org/eclipse/test/Screenshots.java#L110-L143

    public static File getResultsDirectory() {
        File resultsDir = getJunitReportOutput(); // ends up in testresults/linux.gtk.x86_6.0/<class>.<test>.png


        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"));
            }
        }


        resultsDir.mkdirs();
        return resultsDir;
    }


    private static File getJunitReportOutput() {
		boolean platformAvailable = false;
		try {
			Class.forName("org.eclipse.core.runtime.Platform", false, Screenshots.class.getClassLoader());
			platformAvailable = true;
		} catch (ClassNotFoundException e) {
			platformAvailable = false;
		}
		if (platformAvailable) {
			String[] args = Platform.getCommandLineArgs();
			for (int i = 0; i < args.length - 1; i++) {
				if ("-junitReportOutput".equals(args[i])) { // see library.xml and org.eclipse.test.EclipseTestRunner
					return new File(args[i + 1]).getAbsoluteFile();
				}
			}
		}
		return null;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions