Skip to content

Update e2e tests #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2022
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
10 changes: 9 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- nickname: linux
os: ubuntu-latest
graal: 22.0.0.2
name: CI Native ${{ matrix.nickname }}
name: E2E ${{ matrix.nickname }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
Expand All @@ -39,6 +39,14 @@ jobs:
node-version: '14'
- run: |
./mvnw clean package -Pnative
- uses: actions/upload-artifact@v2
with:
name: spring-shell-samples-${{ matrix.nickname }}
retention-days: 1
path: |
spring-shell-samples/target/*.jar
spring-shell-samples/target/spring-shell-samples
spring-shell-samples/target/spring-shell-samples.exe
- name: compile e2e module
working-directory: e2e/spring-shell-e2e
run: |
Expand Down
8 changes: 4 additions & 4 deletions e2e/spring-shell-e2e-tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const cliPath = path.resolve(cliPathRelative);
export const jarPath = path.resolve(jarPathRelative);
export const nativeDesc = 'native';
export const jarDesc = 'jar';
export const jarCommand = 'java';
export const jarCommand = isWindows ? 'java.exe' : 'java';
export const nativeCommand = cliPath;
export const jarOptions = ['-jar', jarPath];
export const waitForExpectDefaultTimeout = 10000;
export const waitForExpectDefaultInterval = 100;
export const testTimeout = 20000;
export const waitForExpectDefaultTimeout = 30000;
export const waitForExpectDefaultInterval = 2000;
export const testTimeout = 100000;
15 changes: 11 additions & 4 deletions spring-shell-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

<description>Examples of using Spring Shell 2</description>

<properties>
<spring-native.version>0.11.1</spring-native.version>
</properties>

<build>
<plugins>
<plugin>
Expand All @@ -37,17 +41,20 @@
</dependency>
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-starter</artifactId>
<artifactId>spring-shell-starter-jna</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-aot</artifactId>
<version>${spring-native.version}</version>
<optional>true</optional>
</dependency>
</dependencies>

<profiles>
<profile>
<id>native</id>
<!-- needs GRAALVM_HOME to point to graal tools -->
<properties>
<spring-native.version>0.11.1</spring-native.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.experimental</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.shell.samples.config;

import com.sun.jna.CallbackReference;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;

import org.springframework.nativex.hint.FieldHint;
import org.springframework.nativex.hint.JdkProxyHint;
import org.springframework.nativex.hint.MethodHint;
import org.springframework.nativex.hint.NativeHint;
import org.springframework.nativex.hint.ResourceHint;
import org.springframework.nativex.hint.TypeAccess;
import org.springframework.nativex.hint.TypeHint;
import org.springframework.nativex.type.NativeConfiguration;

@NativeHint(
resources = {
@ResourceHint(
patterns = {
"completion/.*",
"template/.*.st",
"org/springframework/shell/component/.*.stg",
"com/sun/jna/win32-x86-64/jnidispatch.dll"
}
),
},
types = {
@TypeHint(
types = {
CallbackReference.class, Native.class, NativeLong.class, PointerByReference.class, IntByReference.class
},
typeNames = { "com.sun.jna.Klass" },
access = {
TypeAccess.PUBLIC_CLASSES, TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.PUBLIC_FIELDS,
TypeAccess.PUBLIC_METHODS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
types = Structure.class,
fields = {
@FieldHint( name = "memory", allowWrite = true),
@FieldHint( name = "typeInfo")
},
methods = {
@MethodHint( name = "newInstance", parameterTypes = { Class.class, Pointer.class }),
@MethodHint( name = "newInstance", parameterTypes = { Class.class, long.class }),
@MethodHint( name = "newInstance", parameterTypes = { Class.class })
},
access = {
TypeAccess.PUBLIC_CLASSES, TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.PUBLIC_FIELDS,
TypeAccess.PUBLIC_METHODS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "com.sun.jna.Structure$FFIType",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "com.sun.jna.Structure$FFIType$size_t",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$CHAR_INFO",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$CONSOLE_CURSOR_INFO",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$CONSOLE_SCREEN_BUFFER_INFO",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$COORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$INPUT_RECORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$INPUT_RECORD$EventUnion",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$KEY_EVENT_RECORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$MOUSE_EVENT_RECORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$WINDOW_BUFFER_SIZE_RECORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$MENU_EVENT_RECORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$FOCUS_EVENT_RECORD",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$SMALL_RECT",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
),
@TypeHint(
typeNames = "org.jline.terminal.impl.jna.win.Kernel32$UnionChar",
access = {
TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.DECLARED_CLASSES, TypeAccess.DECLARED_CONSTRUCTORS,
TypeAccess.DECLARED_FIELDS, TypeAccess.DECLARED_METHODS
}
)
},
jdkProxies = {
@JdkProxyHint( typeNames = { "com.sun.jna.Library" }),
@JdkProxyHint( typeNames = { "com.sun.jna.Callback" }),
@JdkProxyHint( typeNames = { "org.jline.terminal.impl.jna.win.Kernel32" }),
@JdkProxyHint( typeNames = { "org.jline.terminal.impl.jna.linux.CLibrary" })
}
)
public class SpringShellNativeConfiguration implements NativeConfiguration {
}
Loading