Skip to content

Commit

Permalink
Convert equinox.launcher.tests into a test-fragment
Browse files Browse the repository at this point in the history
This avoids copying the test

- When building the native launcher and executable, the entire test
project is copied also copied to the specialized build agents, which
unnecessarily increases the traffic.
- Test cannot be executed in the IDE without further setup

- Setting up tests and patching a local developer eclipse should not be
done in a make file, since that is only about building the natives.
  • Loading branch information
HannesWell committed Apr 2, 2024
1 parent 89a8bdc commit 75a34ae
Show file tree
Hide file tree
Showing 20 changed files with 248 additions and 282 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,34 @@ jobs:
sudo apt-get update -q -y
sudo apt-get install -q -y libgtk-3-dev
if: ${{ matrix.config.ws == 'gtk'}}
- name: Build on POSIX
- name: Build native launcher and executable on POSIX
working-directory: features/org.eclipse.equinox.executable.feature/library/${{ matrix.config.ws }}
run: ./build.sh test
run: |
./build.sh
mkdir -p $GITHUB_WORKSPACE/equinox.binaries/org.eclipse.equinox.executable/bin/win32/win32/x86_64/
cp eclipse $GITHUB_WORKSPACE/equinox.binaries/org.eclipse.equinox.executable/bin/win32/win32/x86_64/
mkdir -p $GITHUB_WORKSPACE/equinox.binaries/org.eclipse.equinox.launcher.win32.win32.x86_64/
rm -f $GITHUB_WORKSPACE/equinox.binaries/org.eclipse.equinox.launcher.win32.win32.x86_64/eclipse_*.so
cp eclipse_*.so $GITHUB_WORKSPACE/equinox.binaries/org.eclipse.equinox.launcher.win32.win32.x86_64/
if: ${{ matrix.config.ws != 'win32'}}
- name: Build on Windows
working-directory: features/org.eclipse.equinox.executable.feature/library/${{ matrix.config.ws }}
run: .\build.bat test
- name: Build native launcher and executable on Windows
working-directory: features/org.eclipse.equinox.executable.feature/library/win32
run: |
.\build.bat
mkdir $env:GITHUB_WORKSPACE\equinox.binaries\org.eclipse.equinox.executable\bin\win32\win32\x86_64\
copy eclipse*.exe $env:GITHUB_WORKSPACE\equinox.binaries\org.eclipse.equinox.executable\bin\win32\win32\x86_64\
mkdir $env:GITHUB_WORKSPACE\equinox.binaries\org.eclipse.equinox.launcher.win32.win32.x86_64\
del $env:GITHUB_WORKSPACE\equinox.binaries\org.eclipse.equinox.launcher.win32.win32.x86_64\eclipse_*.dll
copy eclipse_*.dll $env:GITHUB_WORKSPACE\equinox.binaries\org.eclipse.equinox.launcher.win32.win32.x86_64\
if: ${{ matrix.config.ws == 'win32'}}

- name: Test native launcher and executable
env:
rt.equinox.binaries.loc: ${{ github.workspace }}/equinox.binaries
run: mvn -B -pl org.eclipse.equinox:org.eclipse.equinox.launcher.tests -am verify

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
Expand Down
15 changes: 15 additions & 0 deletions bundles/org.eclipse.equinox.launcher.tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.launcher.tests</name>
<name>org.eclipse.equinox.launcher.tests</name>
<comment></comment>
<projects>
</projects>
Expand All @@ -11,13 +11,18 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
10 changes: 10 additions & 0 deletions bundles/org.eclipse.equinox.launcher.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests
Bundle-SymbolicName: org.eclipse.equinox.launcher.tests
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.eclipse.equinox.launcher
Automatic-Module-Name: org.eclipse.launcher.tests
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: org.junit.jupiter.api;version="[5.10.0,6.0.0)",
org.junit.jupiter.api.io;version="[5.10.0,6.0.0)"
4 changes: 4 additions & 0 deletions bundles/org.eclipse.equinox.launcher.tests/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 Eclipse Foundation, Inc. and others.
* Copyright (c) 2023, 2024 Eclipse Foundation, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -39,6 +39,13 @@
*/
public class TestLauncherApp {

public static final String ARGS_PARAMETER = "-args"; //$NON-NLS-1$
public static final String EXITDATA_PARAMETER = "-exitdata"; //$NON-NLS-1$
public static final String EXITCODE_PARAMETER = "-exitcode"; //$NON-NLS-1$
public static final String MULTILINE_ARG_VALUE_TERMINATOR = "---"; //$NON-NLS-1$

public static final String PORT_ENV_KEY = "eclipse_test_port"; //$NON-NLS-1$

private static JNIBridge bridge;
private static String sharedId;
private static String[] args;
Expand Down Expand Up @@ -84,25 +91,25 @@ private static void parseArgs(String[] args) {
}

private static void communicateToServer() throws Exception {
String port = System.getenv(TestLauncherConstants.PORT_ENV_KEY);
String port = System.getenv(PORT_ENV_KEY);
try (Socket socket = new Socket()) {
socket.connect(new InetSocketAddress("localhost", Integer.parseInt(port)), 10000);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
String line;
while ((line = in.readLine()) != null) {
if (TestLauncherConstants.ARGS_PARAMETER.equals(line)) {
out.writeBytes(String.join("\n", args) + "\n" + TestLauncherConstants.MULTILINE_ARG_VALUE_TERMINATOR + "\n");
if (ARGS_PARAMETER.equals(line)) {
out.writeBytes(String.join("\n", args) + "\n" + MULTILINE_ARG_VALUE_TERMINATOR + "\n");
out.flush();
} else if (TestLauncherConstants.EXITDATA_PARAMETER.equals(line)) {
} else if (EXITDATA_PARAMETER.equals(line)) {
while ((line = in.readLine()) != null) {
if (TestLauncherConstants.MULTILINE_ARG_VALUE_TERMINATOR.equals(line)) {
if (MULTILINE_ARG_VALUE_TERMINATOR.equals(line)) {
break;
}
exitData.add(line);
}
} else if (TestLauncherConstants.EXITCODE_PARAMETER.equals(line)) {
TestLauncherApp.exitCode = Integer.parseInt(in.readLine());
} else if (EXITCODE_PARAMETER.equals(line)) {
exitCode = Integer.parseInt(in.readLine());
break;
}
}
Expand Down
Loading

0 comments on commit 75a34ae

Please sign in to comment.