JNI for test coverage #3965
This commit is contained in:
parent
dd8eb8bef9
commit
20cf22665e
|
@ -17,6 +17,15 @@ jobs:
|
|||
- name: Test Compiler
|
||||
run: javac -version
|
||||
|
||||
- name: Print GCC version
|
||||
working-directory: .
|
||||
run: gcc -v
|
||||
|
||||
- name: Build Native Unit Tests as shared library
|
||||
working-directory: ./unit_tests/
|
||||
# we have a unit test of JNI thus we need to build shared library
|
||||
run: make -j4
|
||||
|
||||
- name: Build Android
|
||||
env:
|
||||
RUSEFI_ANDROID_KEYPASS: ${{ secrets.RUSEFI_ANDROID_KEYPASS }}
|
||||
|
|
|
@ -29,7 +29,7 @@ jobs:
|
|||
working-directory: .
|
||||
run: gcc -v
|
||||
|
||||
- name: Build Tests
|
||||
- name: Build Native Unit Tests as shared library
|
||||
working-directory: ./unit_tests/
|
||||
# we have a unit test of JNI thus we need to build shared library
|
||||
run: make -j4
|
||||
|
|
|
@ -8,6 +8,10 @@ configurations {
|
|||
all*.exclude group: 'org.hamcrest', module: 'hamcrest-core'
|
||||
}
|
||||
|
||||
tasks.withType(Test) {
|
||||
systemProperty "java.library.path", "../../unit_tests/build"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation libs.javaxJson
|
||||
implementation project(':inifile')
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Arrays;
|
|||
*/
|
||||
public class JniSandbox {
|
||||
|
||||
private static final String LIBNAME = "lib_rusefi_test";
|
||||
private static final String LIBNAME = "_rusefi_test";
|
||||
|
||||
public static void main(String[] args) {
|
||||
loadLibrary();
|
||||
|
@ -22,7 +22,8 @@ public class JniSandbox {
|
|||
|
||||
public static void loadLibrary() {
|
||||
String libPath = System.getProperty("java.library.path");
|
||||
String[] list = new File(libPath).list((dir, name) -> name.startsWith(LIBNAME));
|
||||
System.out.println("Checking " + libPath);
|
||||
String[] list = new File(libPath).list((dir, name) -> name.contains(LIBNAME));
|
||||
System.out.println(" " + Arrays.toString(list));
|
||||
System.loadLibrary(LIBNAME);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.rusefi.native_;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
public class JniUnitTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void run() {
|
||||
JniSandbox.loadLibrary();
|
||||
|
||||
|
|
|
@ -9,13 +9,14 @@ ifeq ($(BUILDDIR),.)
|
|||
BUILDDIR = build
|
||||
endif
|
||||
BINARY_OUTPUT = $(BUILDDIR)/$(PROJECT)
|
||||
SHARED_OUTPUT = $(BUILDDIR)/lib_$(PROJECT)
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# todo: something is not right here how can we avoid explicit suffix?
|
||||
# should not gcc figure it out based on 'shared' option?
|
||||
SHARED_OUTPUT = $(BUILDDIR)/_$(PROJECT)
|
||||
SHARED_OUTPUT_OPT = $(SHARED_OUTPUT).dll
|
||||
else
|
||||
SHARED_OUTPUT = $(BUILDDIR)/lib_$(PROJECT)
|
||||
SHARED_OUTPUT_OPT = $(SHARED_OUTPUT).so
|
||||
endif
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ PCHSUB = unit_tests
|
|||
include $(PROJECT_DIR)/rusefi_rules.mk
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
SANITIZE = yes
|
||||
# at the moment lib asan breaks JNI static library
|
||||
SANITIZE = no
|
||||
else
|
||||
SANITIZE = no
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue