diff options
author | Sven Gothel <[email protected]> | 2021-01-25 23:56:30 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-01-25 23:56:30 +0100 |
commit | 959c604af7c100d7d06b51d92d16aed64fac286f (patch) | |
tree | 014cebb20f5aa73d6ee67d93aaa55e618c48a3c9 /test | |
parent | 7054cd13119c6dc5e113dc5436e226ad70b380fc (diff) |
Complete build change: Using jaulib[_fat] if available (for Java) incl. native lib loading. Added junit test facility (Java).
Diffstat (limited to 'test')
-rw-r--r-- | test/java/CMakeLists.txt | 38 | ||||
-rw-r--r-- | test/java/manifest.txt.in | 25 |
2 files changed, 63 insertions, 0 deletions
diff --git a/test/java/CMakeLists.txt b/test/java/CMakeLists.txt new file mode 100644 index 00000000..9ef771d3 --- /dev/null +++ b/test/java/CMakeLists.txt @@ -0,0 +1,38 @@ +# java/CMakeLists.txt + +find_jar(JUNIT_JAR + NAMES junit4 junit + PATHS "/usr/share/java") + +set(direct_bt_test_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt_test.jar CACHE FILEPATH "direct_bt test jar file" FORCE) + +file(GLOB_RECURSE TEST_JAVA_SOURCES "*.java") + +file(GLOB_RECURSE TEST_JAVA_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Test*.java") + +add_jar(direct_bt_test + ${TEST_JAVA_SOURCES} + INCLUDE_JARS ${jaulib_fat_jar_file} ${direct_bt_fat_jar_file} ${jaulib_test_jar_file} ${JUNIT_JAR} + MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt + OUTPUT_NAME direct_bt_test +) +add_dependencies(direct_bt_test jaulib_fat_jar direct_bt_fat_jar jaulib_test) + +install (FILES ${direct_bt_test_jar_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java) + +string( REPLACE ".java" "" TEST_JAVA_FILES2 "${TEST_JAVA_FILES}" ) +string( REPLACE "/" "." BASENAMES_IDIOMATIC_EXAMPLES "${TEST_JAVA_FILES2}" ) +set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) + +set(ALL_EXAMPLE_TARGETS + ${TARGETS_IDIOMATIC_EXAMPLES} +) + +foreach(name ${ALL_EXAMPLE_TARGETS}) + add_test (NAME ${name} COMMAND ${JAVA_RUNTIME} + -cp ${JUNIT_JAR}:${jaulib_fat_jar_file}:${direct_bt_fat_jar_file}:${jaulib_test_jar_file}:${direct_bt_test_jar_file} + org.junit.runner.JUnitCore ${name}) +endforeach() + + + diff --git a/test/java/manifest.txt.in b/test/java/manifest.txt.in new file mode 100644 index 00000000..b3cbad8b --- /dev/null +++ b/test/java/manifest.txt.in @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-Date: @BUILD_TSTAMP@ +Bundle-ManifestVersion: 2 +Bundle-Name: org.direct_bt.test +Bundle-SymbolicName: org.direct_bt.test +Bundle-Version: @VERSION_SHORT@ +Export-Package: org.direct_bt.test +Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.9))" +Package-Title: org.direct_bt.test +Package-Vendor: Gothel Software +Package-Version: @VERSION_SHORT@ +Specification-Title: Direct-BT Unit Tests +Specification-Vendor: Gothel Software +Specification-Version: @VERSION_API@ +Implementation-Title: Direct-BT Unit Tests +Implementation-Vendor: Gothel Software +Implementation-Version: @VERSION@ +Implementation-Commit: @VERSION_SHA1@ +Implementation-URL: http://www.jausoft.com/ +Extension-Name: org.direct_bt.test +Trusted-Library: true +Permissions: all-permissions +Application-Library-Allowable-Codebase: * +Class-Path: jaulib_fat.jar direct_bt_fat.jar jaulib_test.jar +Main-Class: org.jau.util.TestVersionInfo |