From: Matt Corallo Date: Tue, 15 Jun 2021 22:02:19 +0000 (+0000) Subject: Build a test jar which we can run to test the built jar is runnable X-Git-Tag: v0.0.98.2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=88b220f3e76e02ec5f05ed6d791c96edcb9eb2f6;p=ldk-java Build a test jar which we can run to test the built jar is runnable --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66c49dea..24eb674c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,10 +53,8 @@ jobs: run: | rm liblightningjni.so ln -s liblightningjni_debug_Linux-amd64.so liblightningjni.so - export LD_LIBRARY_PATH=. - export LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so export ASAN_OPTIONS=detect_leaks=0 - mvn test + LD_PRELOAD=/usr/lib/llvm-11/lib/clang/11.0.1/lib/linux/libclang_rt.asan-x86_64.so LD_LIBRARY_PATH=. mvn test git checkout liblightningjni.so - name: Build Java/TS Release Bindings run: | @@ -76,3 +74,11 @@ jobs: - name: Check latest headers and release lib are in git run: | git diff --exit-code + - name: Run Java Tests against built release jar + run: | + mvn -DskipTests=true package + mvn install:install-file -Dfile=target/ldk-java-1.0-SNAPSHOT.jar -DgroupId=org.ldk -DartifactId=ldk-java -Dversion=1.0-SNAPSHOT -Dpackaging=jar + cd javatester + mvn package + java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar + cd .. diff --git a/javatester/pom.xml b/javatester/pom.xml new file mode 100644 index 00000000..02137e3f --- /dev/null +++ b/javatester/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.ldk + ldk-java-tests + 1.0-SNAPSHOT + + + org.junit.jupiter + junit-jupiter-api + RELEASE + compile + + + org.bitcoinj + bitcoinj-core + 0.15.10 + compile + + + org.jetbrains + annotations + RELEASE + compile + + + org.ldk + ldk-java + 1.0-SNAPSHOT + compile + + + + 1.8 + 1.8 + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.2.0 + + + package + + single + + + + + org.ldk.HumanObjectPeerTest + + + + jar-with-dependencies + + + + + + + + diff --git a/javatester/src/main/java/org/ldk/HumanObjectPeerTest.java b/javatester/src/main/java/org/ldk/HumanObjectPeerTest.java new file mode 120000 index 00000000..59d36734 --- /dev/null +++ b/javatester/src/main/java/org/ldk/HumanObjectPeerTest.java @@ -0,0 +1 @@ +../../../../../../src/test/java/org/ldk/HumanObjectPeerTest.java \ No newline at end of file diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index bb3859d2..c6a6f475 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -897,4 +897,15 @@ public class HumanObjectPeerTest { do_test(nice_close, use_km_wrapper, use_manual_watch, reload_peers, break_cross_refs, nio_peer_handler, use_chan_manager_constructor); } } + + // This is used in the test jar to test the built jar is runnable + public static void main(String[] args) { + try { + new HumanObjectPeerTest().test_message_handler(); + } catch (Exception e) { + System.err.println("Caught exception:"); + System.err.println(e); + System.exit(1); + } + } }